@acemir/cssom 0.9.15 → 0.9.16
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 +6 -6
- package/lib/CSSStyleSheet.js +6 -6
- package/package.json +1 -1
package/build/CSSOM.js
CHANGED
|
@@ -1038,13 +1038,13 @@ CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;
|
|
|
1038
1038
|
*/
|
|
1039
1039
|
CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
1040
1040
|
if (rule === undefined && index === undefined) {
|
|
1041
|
-
throw new TypeError("Failed to execute 'insertRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
1041
|
+
throw new (this._globalObject && this._globalObject.TypeError || TypeError)("Failed to execute 'insertRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
1042
1042
|
}
|
|
1043
1043
|
if (index === void 0) {
|
|
1044
1044
|
index = 0;
|
|
1045
1045
|
}
|
|
1046
1046
|
if (index < 0 || index > this.cssRules.length) {
|
|
1047
|
-
throw new RangeError("INDEX_SIZE_ERR");
|
|
1047
|
+
throw new (this._globalObject && this._globalObject.RangeError || RangeError)("INDEX_SIZE_ERR");
|
|
1048
1048
|
}
|
|
1049
1049
|
var ruleToParse = String(rule);
|
|
1050
1050
|
var parsedSheet = CSSOM.parse(ruleToParse);
|
|
@@ -1053,7 +1053,7 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
1053
1053
|
if (ruleToParse.trimStart().startsWith('@namespace')) {
|
|
1054
1054
|
domExceptionName = "InvalidStateError";
|
|
1055
1055
|
}
|
|
1056
|
-
throw new DOMException("Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '" + ruleToParse + "'.", domExceptionName);
|
|
1056
|
+
throw new (this._globalObject && this._globalObject.DOMException || DOMException)("Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '" + ruleToParse + "'.", domExceptionName);
|
|
1057
1057
|
}
|
|
1058
1058
|
var cssRule = parsedSheet.cssRules[0];
|
|
1059
1059
|
cssRule.parentStyleSheet = this;
|
|
@@ -1077,21 +1077,21 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
1077
1077
|
*/
|
|
1078
1078
|
CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
|
|
1079
1079
|
if (index === undefined) {
|
|
1080
|
-
throw new TypeError("Failed to execute 'deleteRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
1080
|
+
throw new (this._globalObject && this._globalObject.TypeError || TypeError)("Failed to execute 'deleteRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
1081
1081
|
}
|
|
1082
1082
|
index = Number(index);
|
|
1083
1083
|
if (index < 0) {
|
|
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 + ").", "IndexSizeError");
|
|
1087
|
+
throw new (this._globalObject && this._globalObject.DOMException || 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.", "InvalidStateError");
|
|
1094
|
+
throw new (this._globalObject && this._globalObject.DOMException || 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
|
@@ -38,13 +38,13 @@ CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;
|
|
|
38
38
|
*/
|
|
39
39
|
CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
40
40
|
if (rule === undefined && index === undefined) {
|
|
41
|
-
throw new TypeError("Failed to execute 'insertRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
41
|
+
throw new (this._globalObject && this._globalObject.TypeError || TypeError)("Failed to execute 'insertRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
42
42
|
}
|
|
43
43
|
if (index === void 0) {
|
|
44
44
|
index = 0;
|
|
45
45
|
}
|
|
46
46
|
if (index < 0 || index > this.cssRules.length) {
|
|
47
|
-
throw new RangeError("INDEX_SIZE_ERR");
|
|
47
|
+
throw new (this._globalObject && this._globalObject.RangeError || RangeError)("INDEX_SIZE_ERR");
|
|
48
48
|
}
|
|
49
49
|
var ruleToParse = String(rule);
|
|
50
50
|
var parsedSheet = CSSOM.parse(ruleToParse);
|
|
@@ -53,7 +53,7 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
53
53
|
if (ruleToParse.trimStart().startsWith('@namespace')) {
|
|
54
54
|
domExceptionName = "InvalidStateError";
|
|
55
55
|
}
|
|
56
|
-
throw new DOMException("Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '" + ruleToParse + "'.", domExceptionName);
|
|
56
|
+
throw new (this._globalObject && this._globalObject.DOMException || DOMException)("Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '" + ruleToParse + "'.", domExceptionName);
|
|
57
57
|
}
|
|
58
58
|
var cssRule = parsedSheet.cssRules[0];
|
|
59
59
|
cssRule.parentStyleSheet = this;
|
|
@@ -77,21 +77,21 @@ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
|
77
77
|
*/
|
|
78
78
|
CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
|
|
79
79
|
if (index === undefined) {
|
|
80
|
-
throw new TypeError("Failed to execute 'deleteRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
80
|
+
throw new (this._globalObject && this._globalObject.TypeError || TypeError)("Failed to execute 'deleteRule' on 'CSSStyleSheet': 1 argument required, but only 0 present.")
|
|
81
81
|
}
|
|
82
82
|
index = Number(index);
|
|
83
83
|
if (index < 0) {
|
|
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 + ").", "IndexSizeError");
|
|
87
|
+
throw new (this._globalObject && this._globalObject.DOMException || 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.", "InvalidStateError");
|
|
94
|
+
throw new (this._globalObject && this._globalObject.DOMException || 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);
|