@acemir/cssom 0.9.21 → 0.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/CSSOM.js +7 -4
- package/lib/CSSStyleSheet.js +1 -1
- package/lib/parse.js +6 -3
- package/package.json +1 -1
package/build/CSSOM.js
CHANGED
|
@@ -1613,7 +1613,7 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
1613
1613
|
'HierarchyRequestError');
|
|
1614
1614
|
}
|
|
1615
1615
|
|
|
1616
|
-
if (parseErrors.length !== 0) {
|
|
1616
|
+
if (parseErrors.filter(function(error) { return !error.isNested; }).length !== 0) {
|
|
1617
1617
|
errorUtils.throwParseError(this, 'insertRule', this.constructor.name, ruleToParse, 'SyntaxError');
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
@@ -3668,7 +3668,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
3668
3668
|
return true;
|
|
3669
3669
|
}
|
|
3670
3670
|
|
|
3671
|
-
function parseError(message) {
|
|
3671
|
+
function parseError(message, isNested) {
|
|
3672
3672
|
var lines = token.substring(0, i).split('\n');
|
|
3673
3673
|
var lineCount = lines.length;
|
|
3674
3674
|
var charCount = lines.pop().length + 1;
|
|
@@ -3677,6 +3677,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
3677
3677
|
/* jshint sub : true */
|
|
3678
3678
|
error['char'] = charCount;
|
|
3679
3679
|
error.styleSheet = styleSheet;
|
|
3680
|
+
error.isNested = !!isNested;
|
|
3680
3681
|
// Print the error but continue parsing the sheet
|
|
3681
3682
|
try {
|
|
3682
3683
|
throw error;
|
|
@@ -3693,7 +3694,9 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
3693
3694
|
case "importRule":
|
|
3694
3695
|
case "namespaceRule":
|
|
3695
3696
|
case "layerBlock":
|
|
3696
|
-
|
|
3697
|
+
if (character !== ";") {
|
|
3698
|
+
token += ";"
|
|
3699
|
+
}
|
|
3697
3700
|
}
|
|
3698
3701
|
}
|
|
3699
3702
|
|
|
@@ -4323,7 +4326,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
4323
4326
|
if (styleRule === nestedSelectorRule) {
|
|
4324
4327
|
nestedSelectorRule = null;
|
|
4325
4328
|
}
|
|
4326
|
-
parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")');
|
|
4329
|
+
parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")', styleRule.parentRule !== null);
|
|
4327
4330
|
} else {
|
|
4328
4331
|
currentScope.cssRules.push(styleRule);
|
|
4329
4332
|
}
|
package/lib/CSSStyleSheet.js
CHANGED
|
@@ -163,7 +163,7 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
163
163
|
'HierarchyRequestError');
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
if (parseErrors.length !== 0) {
|
|
166
|
+
if (parseErrors.filter(function(error) { return !error.isNested; }).length !== 0) {
|
|
167
167
|
errorUtils.throwParseError(this, 'insertRule', this.constructor.name, ruleToParse, 'SyntaxError');
|
|
168
168
|
}
|
|
169
169
|
}
|
package/lib/parse.js
CHANGED
|
@@ -880,7 +880,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
880
880
|
return true;
|
|
881
881
|
}
|
|
882
882
|
|
|
883
|
-
function parseError(message) {
|
|
883
|
+
function parseError(message, isNested) {
|
|
884
884
|
var lines = token.substring(0, i).split('\n');
|
|
885
885
|
var lineCount = lines.length;
|
|
886
886
|
var charCount = lines.pop().length + 1;
|
|
@@ -889,6 +889,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
889
889
|
/* jshint sub : true */
|
|
890
890
|
error['char'] = charCount;
|
|
891
891
|
error.styleSheet = styleSheet;
|
|
892
|
+
error.isNested = !!isNested;
|
|
892
893
|
// Print the error but continue parsing the sheet
|
|
893
894
|
try {
|
|
894
895
|
throw error;
|
|
@@ -905,7 +906,9 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
905
906
|
case "importRule":
|
|
906
907
|
case "namespaceRule":
|
|
907
908
|
case "layerBlock":
|
|
908
|
-
|
|
909
|
+
if (character !== ";") {
|
|
910
|
+
token += ";"
|
|
911
|
+
}
|
|
909
912
|
}
|
|
910
913
|
}
|
|
911
914
|
|
|
@@ -1535,7 +1538,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
|
|
|
1535
1538
|
if (styleRule === nestedSelectorRule) {
|
|
1536
1539
|
nestedSelectorRule = null;
|
|
1537
1540
|
}
|
|
1538
|
-
parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")');
|
|
1541
|
+
parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")', styleRule.parentRule !== null);
|
|
1539
1542
|
} else {
|
|
1540
1543
|
currentScope.cssRules.push(styleRule);
|
|
1541
1544
|
}
|