@acemir/cssom 0.9.7 → 0.9.8

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
@@ -2306,7 +2306,7 @@ CSSOM.parse = function parse(token, errorHandler) {
2306
2306
  state = "before-selector";
2307
2307
  } else if (state === "counterStyleBlock") {
2308
2308
  // TODO: Validate counter-style name. At least that it cannot be empty nor multiple
2309
- counterStyleRule.name = buffer.trim();
2309
+ counterStyleRule.name = buffer.trim().replace(/\n/g, "");
2310
2310
  currentScope = parentRule = counterStyleRule;
2311
2311
  counterStyleRule.parentStyleSheet = styleSheet;
2312
2312
  buffer = "";
@@ -2546,7 +2546,9 @@ CSSOM.parse = function parse(token, errorHandler) {
2546
2546
  case "}":
2547
2547
  if (state === "counterStyleBlock") {
2548
2548
  // FIXME : Implement cssText get setter that parses the real implementation
2549
- counterStyleRule.cssText = "@counter-style " + counterStyleRule.name + " { " + buffer.trim() + " }";
2549
+ counterStyleRule.cssText = "@counter-style " + counterStyleRule.name + " { " + buffer.trim().replace(/\n/g, " ").replace(/(['"])(?:\\.|[^\\])*?\1|(\s{2,})/g, function(match, quote, spaces) {
2550
+ return quote ? match : ' ';
2551
+ }) + " }";
2550
2552
  buffer = "";
2551
2553
  state = "before-selector";
2552
2554
  }
package/lib/parse.js CHANGED
@@ -725,7 +725,7 @@ CSSOM.parse = function parse(token, errorHandler) {
725
725
  state = "before-selector";
726
726
  } else if (state === "counterStyleBlock") {
727
727
  // TODO: Validate counter-style name. At least that it cannot be empty nor multiple
728
- counterStyleRule.name = buffer.trim();
728
+ counterStyleRule.name = buffer.trim().replace(/\n/g, "");
729
729
  currentScope = parentRule = counterStyleRule;
730
730
  counterStyleRule.parentStyleSheet = styleSheet;
731
731
  buffer = "";
@@ -965,7 +965,9 @@ CSSOM.parse = function parse(token, errorHandler) {
965
965
  case "}":
966
966
  if (state === "counterStyleBlock") {
967
967
  // FIXME : Implement cssText get setter that parses the real implementation
968
- counterStyleRule.cssText = "@counter-style " + counterStyleRule.name + " { " + buffer.trim() + " }";
968
+ counterStyleRule.cssText = "@counter-style " + counterStyleRule.name + " { " + buffer.trim().replace(/\n/g, " ").replace(/(['"])(?:\\.|[^\\])*?\1|(\s{2,})/g, function(match, quote, spaces) {
969
+ return quote ? match : ' ';
970
+ }) + " }";
969
971
  buffer = "";
970
972
  state = "before-selector";
971
973
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "parser",
8
8
  "styleSheet"
9
9
  ],
10
- "version": "0.9.7",
10
+ "version": "0.9.8",
11
11
  "author": "Nikita Vasilyev <me@elv1s.ru>",
12
12
  "contributors": [
13
13
  "Acemir Sousa Mendes <acemirsm@gmail.com>"