don't throw error on comments in template converter
This commit is contained in:
parent
c736e738ce
commit
7f62ab4954
1 changed files with 3 additions and 2 deletions
|
|
@ -12,13 +12,13 @@ templateConverter.VirtualFragment = function recurse(domFragment) {
|
||||||
if (el.nodeType == 3) {
|
if (el.nodeType == 3) {
|
||||||
virtualFragment.push(el.nodeValue);
|
virtualFragment.push(el.nodeValue);
|
||||||
}
|
}
|
||||||
else {
|
else if (el.nodeType == 1) {
|
||||||
var attrs = {};
|
var attrs = {};
|
||||||
for (var j = 0, attr; attr = el.attributes[j]; j++) {
|
for (var j = 0, attr; attr = el.attributes[j]; j++) {
|
||||||
attrs[attr.name] = attr.value;
|
attrs[attr.name] = attr.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtualFragment.push({tag: el.tagName.toLowerCase(), attrs: attrs, children: recurse(el.childNodes)});
|
virtualFragment.push({tag: el.nodeName.toLowerCase(), attrs: attrs, children: recurse(el.childNodes)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return virtualFragment;
|
return virtualFragment;
|
||||||
|
|
@ -49,6 +49,7 @@ templateConverter.Template = function recurse() {
|
||||||
for (var j = 0, attrName; attrName = attrNames[j]; j++) {
|
for (var j = 0, attrName; attrName = attrNames[j]; j++) {
|
||||||
if (attrName != "style") virtual += "[" + attrName + "='" + el.attrs[attrName].replace(/'/g, "\\'") + "']";
|
if (attrName != "style") virtual += "[" + attrName + "='" + el.attrs[attrName].replace(/'/g, "\\'") + "']";
|
||||||
}
|
}
|
||||||
|
if (virtual == "") virtual = "div"
|
||||||
virtual = '"' + virtual + '"';
|
virtual = '"' + virtual + '"';
|
||||||
|
|
||||||
var style = ""
|
var style = ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue