fahrplan_download.js: don't serialize <textarea/> emptily
This commit is contained in:
parent
252a7a1923
commit
2f1672ace2
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue