fahrplan_download.js: don't serialize <textarea/> emptily

This commit is contained in:
Astro 2010-10-17 15:31:52 +02:00
parent 252a7a1923
commit 2f1672ace2
1 changed files with 7 additions and 0 deletions

View File

@ -70,6 +70,8 @@ function downloadTo(path) {
};
}
var NON_EMPTY_ELS = ["textarea", "ul", "ol"];
function downloadXml(path, attrMapper) {
return function(res) {
ensureDirs(path);
@ -91,6 +93,11 @@ function downloadXml(path, attrMapper) {
el = child;
});
p.addListener('endElement', function(name) {
if (NON_EMPTY_ELS.indexOf(name) >= 0 &&
el.children.length == 0)
// prevent some empty elements
el.t('');
if (!el.parent) {
f.write(el.toString());
el = undefined;