diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-11-28 21:08:40 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-11-28 21:08:40 +0000 |
| commit | a12b966752ba7ae880f7d6348a42cc986e891a82 (patch) | |
| tree | ab244d36ea978f5b75021c9c6b49b53376f33aef /lib/html/ast.js | |
| parent | 481d5860686b6b02b5536d7455b88baf7325ecfd (diff) | |
Map breaks with style maps
Diffstat (limited to 'lib/html/ast.js')
| -rw-r--r-- | lib/html/ast.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/html/ast.js b/lib/html/ast.js index c949550..34b9a3d 100644 --- a/lib/html/ast.js +++ b/lib/html/ast.js @@ -8,12 +8,8 @@ function nonFreshElement(tagName, attributes, children) { } function freshElement(tagName, attributes, children) { - if (isVoidElement(tagName, children)) { - return selfClosingElement(tagName, attributes); - } else { - var tag = htmlPaths.element(tagName, attributes, {fresh: true}); - return elementWithTag(tag, children); - } + var tag = htmlPaths.element(tagName, attributes, {fresh: true}); + return elementWithTag(tag, children); } var voidTagNames = { @@ -22,16 +18,20 @@ var voidTagNames = { "img": true }; -function isVoidElement(tagName, children) { - return (!children || children.length === 0) && voidTagNames[tagName]; +function elementWithTag(tag, children) { + if (isVoidElement(tag.tagName, children)) { + return selfClosingElement(tag.tagName, tag.attributes); + } else { + return { + type: "element", + tag: tag, + children: children || [] + }; + } } -function elementWithTag(tag, children) { - return { - type: "element", - tag: tag, - children: children || [] - }; +function isVoidElement(tagName, children) { + return (!children || children.length === 0) && voidTagNames[tagName]; } function selfClosingElement(tagName, attributes) { |
