aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-03-29 21:38:11 +0000
committerMichael Williamson <mike@zwobble.org>2013-03-29 21:38:11 +0000
commitd978f126b9847f45f17f4bd8419236a99bfe99a9 (patch)
tree58d3ab54be00f9b5defa4244a7b6f5c7324837e0 /lib
parent53e7181e009efcdcad182d485972bfbfda982fc0 (diff)
Pull out function for comparing style parts with HTML elements
Diffstat (limited to 'lib')
-rw-r--r--lib/html-generator.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/html-generator.js b/lib/html-generator.js
index 5f2befa..8a67e53 100644
--- a/lib/html-generator.js
+++ b/lib/html-generator.js
@@ -24,7 +24,7 @@ function HtmlGenerator() {
});
var partIndex = 0;
- while (partIndex < firstFreshPartIndex && style[partIndex].tagName === stack[partIndex]) {
+ while (partIndex < firstFreshPartIndex && stylePartMatchesHtmlElement(style[partIndex], stack[partIndex])) {
partIndex++;
}
while (stack.length > partIndex) {
@@ -35,6 +35,10 @@ function HtmlGenerator() {
}
}
+ function stylePartMatchesHtmlElement(stylePart, htmlElement) {
+ return stylePart.tagName === htmlElement;
+ }
+
function push(element) {
stack.push(element);
fragments.push(util.format("<%s>", element));