@acemir/cssom 0.9.21 → 0.9.22

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 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;
@@ -4323,7 +4324,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
4323
4324
  if (styleRule === nestedSelectorRule) {
4324
4325
  nestedSelectorRule = null;
4325
4326
  }
4326
- parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")');
4327
+ parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")', styleRule.parentRule !== null);
4327
4328
  } else {
4328
4329
  currentScope.cssRules.push(styleRule);
4329
4330
  }
@@ -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;
@@ -1535,7 +1536,7 @@ CSSOM.parse = function parse(token, opts, errorHandler) {
1535
1536
  if (styleRule === nestedSelectorRule) {
1536
1537
  nestedSelectorRule = null;
1537
1538
  }
1538
- parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")');
1539
+ parseError('Invalid CSSStyleRule (selectorText = "' + styleRule.selectorText + '")', styleRule.parentRule !== null);
1539
1540
  } else {
1540
1541
  currentScope.cssRules.push(styleRule);
1541
1542
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "parser",
8
8
  "styleSheet"
9
9
  ],
10
- "version": "0.9.21",
10
+ "version": "0.9.22",
11
11
  "author": "Nikita Vasilyev <me@elv1s.ru>",
12
12
  "contributors": [
13
13
  "Acemir Sousa Mendes <acemirsm@gmail.com>"