@acemir/cssom 0.9.14 → 0.9.15
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 +4 -4
- package/lib/CSSStyleSheet.js +4 -4
- package/package.json +1 -1
package/build/CSSOM.js
CHANGED
|
@@ -1049,9 +1049,9 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
1049
1049
|
var ruleToParse = String(rule);
|
|
1050
1050
|
var parsedSheet = CSSOM.parse(ruleToParse);
|
|
1051
1051
|
if (parsedSheet.cssRules.length !== 1) {
|
|
1052
|
-
var domExceptionName =
|
|
1052
|
+
var domExceptionName = "SyntaxError";
|
|
1053
1053
|
if (ruleToParse.trimStart().startsWith('@namespace')) {
|
|
1054
|
-
domExceptionName =
|
|
1054
|
+
domExceptionName = "InvalidStateError";
|
|
1055
1055
|
}
|
|
1056
1056
|
throw new DOMException("Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '" + ruleToParse + "'.", domExceptionName);
|
|
1057
1057
|
}
|
|
@@ -1084,14 +1084,14 @@ CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
|
|
|
1084
1084
|
index = 4294967296 + index;
|
|
1085
1085
|
}
|
|
1086
1086
|
if (index >= this.cssRules.length) {
|
|
1087
|
-
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': The index provided (" + index + ") is larger than the maximum index (" + this.cssRules.length + ").",
|
|
1087
|
+
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': The index provided (" + index + ") is larger than the maximum index (" + this.cssRules.length + ").", "IndexSizeError");
|
|
1088
1088
|
}
|
|
1089
1089
|
if (this.cssRules[index] && this.cssRules[index].constructor.name == "CSSNamespaceRule") {
|
|
1090
1090
|
var shouldContinue = this.cssRules.every(function (rule) {
|
|
1091
1091
|
return ['CSSImportRule','CSSLayerStatementRule','CSSNamespaceRule'].indexOf(rule.constructor.name) !== -1
|
|
1092
1092
|
});
|
|
1093
1093
|
if (!shouldContinue) {
|
|
1094
|
-
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': Deleting a CSSNamespaceRule is not allowed when there is rules other than @import, @layer statement, or @namespace.",
|
|
1094
|
+
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': Deleting a CSSNamespaceRule is not allowed when there is rules other than @import, @layer statement, or @namespace.", "InvalidStateError");
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
this.cssRules.splice(index, 1);
|
package/lib/CSSStyleSheet.js
CHANGED
|
@@ -49,9 +49,9 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
49
49
|
var ruleToParse = String(rule);
|
|
50
50
|
var parsedSheet = CSSOM.parse(ruleToParse);
|
|
51
51
|
if (parsedSheet.cssRules.length !== 1) {
|
|
52
|
-
var domExceptionName =
|
|
52
|
+
var domExceptionName = "SyntaxError";
|
|
53
53
|
if (ruleToParse.trimStart().startsWith('@namespace')) {
|
|
54
|
-
domExceptionName =
|
|
54
|
+
domExceptionName = "InvalidStateError";
|
|
55
55
|
}
|
|
56
56
|
throw new DOMException("Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '" + ruleToParse + "'.", domExceptionName);
|
|
57
57
|
}
|
|
@@ -84,14 +84,14 @@ CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
|
|
|
84
84
|
index = 4294967296 + index;
|
|
85
85
|
}
|
|
86
86
|
if (index >= this.cssRules.length) {
|
|
87
|
-
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': The index provided (" + index + ") is larger than the maximum index (" + this.cssRules.length + ").",
|
|
87
|
+
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': The index provided (" + index + ") is larger than the maximum index (" + this.cssRules.length + ").", "IndexSizeError");
|
|
88
88
|
}
|
|
89
89
|
if (this.cssRules[index] && this.cssRules[index].constructor.name == "CSSNamespaceRule") {
|
|
90
90
|
var shouldContinue = this.cssRules.every(function (rule) {
|
|
91
91
|
return ['CSSImportRule','CSSLayerStatementRule','CSSNamespaceRule'].indexOf(rule.constructor.name) !== -1
|
|
92
92
|
});
|
|
93
93
|
if (!shouldContinue) {
|
|
94
|
-
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': Deleting a CSSNamespaceRule is not allowed when there is rules other than @import, @layer statement, or @namespace.",
|
|
94
|
+
throw new DOMException("Failed to execute 'deleteRule' on 'CSSStyleSheet': Deleting a CSSNamespaceRule is not allowed when there is rules other than @import, @layer statement, or @namespace.", "InvalidStateError");
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
this.cssRules.splice(index, 1);
|