Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Fix CSS declaration skip after extra semicolon #2023

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/com/google/caja/plugin/cssparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,7 @@ var parseCssDeclarations;
++i;
break;
}
if (tok === ' ') {
i = i+1;
} else {
i = declaration(toks, i, n, handler);
}
i = declaration(toks, i, n, handler);
}
if (handler['endRuleset']) {
handler['endRuleset']();
Expand Down Expand Up @@ -255,6 +251,7 @@ var parseCssDeclarations;
function declaration(toks, i, n, handler) {
var property = toks[i++];
if (!ident.test(property)) {
if (property === ' ' || property === ';') return i;
return skipDeclaration(toks, i, n);
}
var tok;
Expand Down Expand Up @@ -309,7 +306,7 @@ var parseCssDeclarations;
parseCssDeclarations = function(cssText, handler) {
var toks = lexCss(cssText);
for (var i = 0, n = toks.length; i < n;) {
i = toks[i] !== ' ' ? declaration(toks, i, n, handler) : i+1;
i = declaration(toks, i, n, handler);
}
};
})();
Expand Down