aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-10-13 21:09:40 +0100
committerMichael Williamson <mike@zwobble.org>2015-10-13 21:09:40 +0100
commit4163a1ec773f0695baa41000050745df37f789e0 (patch)
treede3245cb3353d3e1d501cd47cde233a55e06bb46 /lib
parent4d05ab04ef7c31886030ea4ca5c1275c9f9c52e0 (diff)
Fix HTML generation when the HTML path has no fresh elements
Diffstat (limited to 'lib')
-rw-r--r--lib/html-generator.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/html-generator.js b/lib/html-generator.js
index a20a714..be5079b 100644
--- a/lib/html-generator.js
+++ b/lib/html-generator.js
@@ -29,7 +29,7 @@ function HtmlGenerator(options) {
function satisfyPath(style) {
var firstFreshPartIndex = findIndex(style, function(part) {
return part.fresh;
- });
+ }, style.length);
var partIndex = 0;
while (partIndex < firstFreshPartIndex && stylePartMatchesStackElement(style[partIndex], stack[partIndex])) {
@@ -102,11 +102,11 @@ function HtmlGenerator(options) {
};
}
-function findIndex(array, predicate) {
+function findIndex(array, predicate, defaultValue) {
for (var i = 0; i < array.length; i++) {
if (predicate(array[i])) {
return i;
}
}
- return -1;
+ return defaultValue;
}