@acemir/cssom 0.9.24 → 0.9.25
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 +1477 -1236
- package/lib/CSSConditionRule.js +3 -1
- package/lib/CSSContainerRule.js +9 -5
- package/lib/CSSCounterStyleRule.js +36 -2
- package/lib/CSSDocumentRule.js +9 -2
- package/lib/CSSFontFaceRule.js +9 -2
- package/lib/CSSGroupingRule.js +65 -9
- package/lib/CSSHostRule.js +9 -2
- package/lib/CSSImportRule.js +49 -39
- package/lib/CSSKeyframeRule.js +9 -2
- package/lib/CSSKeyframesRule.js +8 -2
- package/lib/CSSLayerBlockRule.js +9 -5
- package/lib/CSSLayerStatementRule.js +9 -5
- package/lib/CSSMediaRule.js +9 -5
- package/lib/CSSNamespaceRule.js +27 -17
- package/lib/CSSNestedDeclarations.js +9 -5
- package/lib/CSSOM.js +16 -1
- package/lib/CSSPageRule.js +3 -152
- package/lib/CSSRule.js +10 -0
- package/lib/CSSScopeRule.js +2 -1
- package/lib/CSSStartingStyleRule.js +9 -2
- package/lib/CSSStyleRule.js +3 -154
- package/lib/CSSStyleSheet.js +40 -8
- package/lib/CSSSupportsRule.js +8 -2
- package/lib/CSSValueExpression.js +3 -1
- package/lib/StyleSheet.js +24 -1
- package/lib/errorUtils.js +8 -13
- package/lib/index.js +2 -0
- package/lib/parse.js +1085 -791
- package/package.json +1 -1
package/lib/CSSConditionRule.js
CHANGED
|
@@ -16,9 +16,11 @@ CSSOM.CSSConditionRule = function CSSConditionRule() {
|
|
|
16
16
|
this.__conditionText = '';
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
CSSOM.CSSConditionRule.prototype =
|
|
19
|
+
CSSOM.CSSConditionRule.prototype = Object.create(CSSOM.CSSGroupingRule.prototype);
|
|
20
20
|
CSSOM.CSSConditionRule.prototype.constructor = CSSOM.CSSConditionRule;
|
|
21
21
|
|
|
22
|
+
Object.setPrototypeOf(CSSOM.CSSConditionRule, CSSOM.CSSGroupingRule);
|
|
23
|
+
|
|
22
24
|
Object.defineProperty(CSSOM.CSSConditionRule.prototype, "conditionText", {
|
|
23
25
|
get: function () {
|
|
24
26
|
return this.__conditionText;
|
package/lib/CSSContainerRule.js
CHANGED
|
@@ -17,9 +17,15 @@ CSSOM.CSSContainerRule = function CSSContainerRule() {
|
|
|
17
17
|
CSSOM.CSSConditionRule.call(this);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
CSSOM.CSSContainerRule.prototype =
|
|
20
|
+
CSSOM.CSSContainerRule.prototype = Object.create(CSSOM.CSSConditionRule.prototype);
|
|
21
21
|
CSSOM.CSSContainerRule.prototype.constructor = CSSOM.CSSContainerRule;
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
Object.setPrototypeOf(CSSOM.CSSContainerRule, CSSOM.CSSConditionRule);
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(CSSOM.CSSContainerRule.prototype, "type", {
|
|
26
|
+
value: 17,
|
|
27
|
+
writable: false
|
|
28
|
+
});
|
|
23
29
|
|
|
24
30
|
Object.defineProperties(CSSOM.CSSContainerRule.prototype, {
|
|
25
31
|
"cssText": {
|
|
@@ -36,9 +42,7 @@ Object.defineProperties(CSSOM.CSSContainerRule.prototype, {
|
|
|
36
42
|
}
|
|
37
43
|
values = valuesArr.join("\n ") + "\n}";
|
|
38
44
|
return "@container " + this.conditionText + values;
|
|
39
|
-
}
|
|
40
|
-
configurable: true,
|
|
41
|
-
enumerable: true
|
|
45
|
+
}
|
|
42
46
|
},
|
|
43
47
|
"containerName": {
|
|
44
48
|
get: function() {
|
|
@@ -12,11 +12,45 @@ var CSSOM = {
|
|
|
12
12
|
CSSOM.CSSCounterStyleRule = function CSSCounterStyleRule() {
|
|
13
13
|
CSSOM.CSSRule.call(this);
|
|
14
14
|
this.name = "";
|
|
15
|
+
this.__props = "";
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
CSSOM.CSSCounterStyleRule.prototype =
|
|
18
|
+
CSSOM.CSSCounterStyleRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
18
19
|
CSSOM.CSSCounterStyleRule.prototype.constructor = CSSOM.CSSCounterStyleRule;
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
Object.setPrototypeOf(CSSOM.CSSCounterStyleRule, CSSOM.CSSRule);
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(CSSOM.CSSCounterStyleRule.prototype, "type", {
|
|
24
|
+
value: 11,
|
|
25
|
+
writable: false
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(CSSOM.CSSCounterStyleRule.prototype, "cssText", {
|
|
29
|
+
get: function() {
|
|
30
|
+
// FIXME : Implement real cssText generation based on properties
|
|
31
|
+
return "@counter-style " + this.name + " { " + this.__props + " }";
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* NON-STANDARD
|
|
37
|
+
* Rule text parser.
|
|
38
|
+
* @param {string} cssText
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(CSSOM.CSSCounterStyleRule.prototype, "parse", {
|
|
41
|
+
value: function(cssText) {
|
|
42
|
+
// Extract the name from "@counter-style <name> { ... }"
|
|
43
|
+
var match = cssText.match(/@counter-style\s+([^\s{]+)\s*\{([^]*)\}/);
|
|
44
|
+
if (match) {
|
|
45
|
+
this.name = match[1];
|
|
46
|
+
// Get the text inside the brackets and clean it up
|
|
47
|
+
var propsText = match[2];
|
|
48
|
+
this.__props = propsText.trim().replace(/\n/g, " ").replace(/(['"])(?:\\.|[^\\])*?\1|(\s{2,})/g, function (match, quote) {
|
|
49
|
+
return quote ? match : ' ';
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
20
54
|
|
|
21
55
|
//.CommonJS
|
|
22
56
|
exports.CSSCounterStyleRule = CSSOM.CSSCounterStyleRule;
|
package/lib/CSSDocumentRule.js
CHANGED
|
@@ -18,9 +18,16 @@ CSSOM.CSSDocumentRule = function CSSDocumentRule() {
|
|
|
18
18
|
this.cssRules = new CSSOM.CSSRuleList();
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
CSSOM.CSSDocumentRule.prototype =
|
|
21
|
+
CSSOM.CSSDocumentRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
22
22
|
CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
Object.setPrototypeOf(CSSOM.CSSDocumentRule, CSSOM.CSSRule);
|
|
25
|
+
|
|
26
|
+
Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "type", {
|
|
27
|
+
value: 10,
|
|
28
|
+
writable: false
|
|
29
|
+
});
|
|
30
|
+
|
|
24
31
|
//FIXME
|
|
25
32
|
//CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
|
26
33
|
//CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
package/lib/CSSFontFaceRule.js
CHANGED
|
@@ -22,9 +22,16 @@ CSSOM.CSSFontFaceRule = function CSSFontFaceRule() {
|
|
|
22
22
|
this.__style.parentRule = this;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
CSSOM.CSSFontFaceRule.prototype =
|
|
25
|
+
CSSOM.CSSFontFaceRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
26
26
|
CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
Object.setPrototypeOf(CSSOM.CSSFontFaceRule, CSSOM.CSSRule);
|
|
29
|
+
|
|
30
|
+
Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "type", {
|
|
31
|
+
value: 5,
|
|
32
|
+
writable: false
|
|
33
|
+
});
|
|
34
|
+
|
|
28
35
|
//FIXME
|
|
29
36
|
//CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
|
30
37
|
//CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
package/lib/CSSGroupingRule.js
CHANGED
|
@@ -14,12 +14,19 @@ var errorUtils = require("./errorUtils").errorUtils;
|
|
|
14
14
|
*/
|
|
15
15
|
CSSOM.CSSGroupingRule = function CSSGroupingRule() {
|
|
16
16
|
CSSOM.CSSRule.call(this);
|
|
17
|
-
this.
|
|
17
|
+
this.__cssRules = new CSSOM.CSSRuleList();
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
CSSOM.CSSGroupingRule.prototype
|
|
20
|
+
CSSOM.CSSGroupingRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
21
21
|
CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
|
|
22
22
|
|
|
23
|
+
Object.setPrototypeOf(CSSOM.CSSGroupingRule, CSSOM.CSSRule);
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(CSSOM.CSSGroupingRule.prototype, "cssRules", {
|
|
26
|
+
get: function() {
|
|
27
|
+
return this.__cssRules;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
23
30
|
|
|
24
31
|
/**
|
|
25
32
|
* Used to insert a new CSS rule to a list of CSS rules.
|
|
@@ -51,13 +58,60 @@ CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
|
|
|
51
58
|
if (index > this.cssRules.length) {
|
|
52
59
|
errorUtils.throwIndexError(this, 'insertRule', this.constructor.name, index, this.cssRules.length);
|
|
53
60
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
if (
|
|
58
|
-
|
|
61
|
+
var ruleToParse = processedRuleToParse = String(rule);
|
|
62
|
+
ruleToParse = ruleToParse.trim().replace(/^\/\*[\s\S]*?\*\/\s*/, "");
|
|
63
|
+
var isNestedSelector = this.constructor.name === "CSSStyleRule";
|
|
64
|
+
if (isNestedSelector === false) {
|
|
65
|
+
var currentRule = this;
|
|
66
|
+
while (currentRule.parentRule) {
|
|
67
|
+
currentRule = currentRule.parentRule;
|
|
68
|
+
if (currentRule.constructor.name === "CSSStyleRule") {
|
|
69
|
+
isNestedSelector = true;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (isNestedSelector) {
|
|
75
|
+
processedRuleToParse = 's { n { } ' + ruleToParse + '}';
|
|
76
|
+
}
|
|
77
|
+
var isScopeRule = this.constructor.name === "CSSScopeRule";
|
|
78
|
+
if (isScopeRule) {
|
|
79
|
+
if (isNestedSelector) {
|
|
80
|
+
processedRuleToParse = 's { ' + '@scope {' + ruleToParse + '}}';
|
|
81
|
+
} else {
|
|
82
|
+
processedRuleToParse = '@scope {' + ruleToParse + '}';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
var parsedRules = new CSSOM.CSSRuleList();
|
|
86
|
+
CSSOM.parse(processedRuleToParse, {
|
|
87
|
+
styleSheet: this.parentStyleSheet,
|
|
88
|
+
cssRules: parsedRules
|
|
89
|
+
});
|
|
90
|
+
if (isScopeRule) {
|
|
91
|
+
if (isNestedSelector) {
|
|
92
|
+
parsedRules = parsedRules[0].cssRules[0].cssRules;
|
|
93
|
+
} else {
|
|
94
|
+
parsedRules = parsedRules[0].cssRules
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (isNestedSelector) {
|
|
98
|
+
parsedRules = parsedRules[0].cssRules.slice(1);
|
|
99
|
+
}
|
|
100
|
+
if (parsedRules.length !== 1) {
|
|
101
|
+
if (isNestedSelector && parsedRules.length === 0 && ruleToParse.indexOf('@font-face') === 0) {
|
|
102
|
+
errorUtils.throwError(this, 'DOMException',
|
|
103
|
+
"Failed to execute 'insertRule' on '" + this.constructor.name + "': " +
|
|
104
|
+
"Only conditional nested group rules, style rules, @scope rules, @apply rules, and nested declaration rules may be nested.",
|
|
105
|
+
'HierarchyRequestError');
|
|
106
|
+
} else {
|
|
107
|
+
errorUtils.throwParseError(this, 'insertRule', this.constructor.name, ruleToParse, 'SyntaxError');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var cssRule = parsedRules[0];
|
|
111
|
+
|
|
112
|
+
if (cssRule.constructor.name === 'CSSNestedDeclarations' && cssRule.style.length === 0) {
|
|
113
|
+
errorUtils.throwParseError(this, 'insertRule', this.constructor.name, ruleToParse, 'SyntaxError');
|
|
59
114
|
}
|
|
60
|
-
var cssRule = parsedSheet.cssRules[0];
|
|
61
115
|
|
|
62
116
|
// Check for rules that cannot be inserted inside a CSSGroupingRule
|
|
63
117
|
if (cssRule.constructor.name === 'CSSImportRule' || cssRule.constructor.name === 'CSSNamespaceRule') {
|
|
@@ -101,7 +155,9 @@ CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
|
|
|
101
155
|
if (index >= this.cssRules.length) {
|
|
102
156
|
errorUtils.throwIndexError(this, 'deleteRule', this.constructor.name, index, this.cssRules.length);
|
|
103
157
|
}
|
|
104
|
-
this.cssRules
|
|
158
|
+
this.cssRules[index].__parentRule = null;
|
|
159
|
+
this.cssRules[index].__parentStyleSheet = null;
|
|
160
|
+
this.cssRules.splice(index, 1);
|
|
105
161
|
};
|
|
106
162
|
|
|
107
163
|
//.CommonJS
|
package/lib/CSSHostRule.js
CHANGED
|
@@ -17,9 +17,16 @@ CSSOM.CSSHostRule = function CSSHostRule() {
|
|
|
17
17
|
this.cssRules = new CSSOM.CSSRuleList();
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
CSSOM.CSSHostRule.prototype =
|
|
20
|
+
CSSOM.CSSHostRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
21
21
|
CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
Object.setPrototypeOf(CSSOM.CSSHostRule, CSSOM.CSSRule);
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(CSSOM.CSSHostRule.prototype, "type", {
|
|
26
|
+
value: 1001,
|
|
27
|
+
writable: false
|
|
28
|
+
});
|
|
29
|
+
|
|
23
30
|
//FIXME
|
|
24
31
|
//CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
|
25
32
|
//CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
package/lib/CSSImportRule.js
CHANGED
|
@@ -21,9 +21,11 @@ CSSOM.CSSImportRule = function CSSImportRule() {
|
|
|
21
21
|
this.__styleSheet = new CSSOM.CSSStyleSheet();
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
CSSOM.CSSImportRule.prototype =
|
|
24
|
+
CSSOM.CSSImportRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
25
25
|
CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
|
|
26
26
|
|
|
27
|
+
Object.setPrototypeOf(CSSOM.CSSImportRule, CSSOM.CSSRule);
|
|
28
|
+
|
|
27
29
|
Object.defineProperty(CSSOM.CSSImportRule.prototype, "type", {
|
|
28
30
|
value: 3,
|
|
29
31
|
writable: false
|
|
@@ -33,8 +35,53 @@ Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
|
|
|
33
35
|
get: function() {
|
|
34
36
|
var mediaText = this.media.mediaText;
|
|
35
37
|
return "@import url(\"" + this.href.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + "\")" + (this.layerName !== null ? " layer" + (this.layerName && "(" + this.layerName + ")") : "" ) + (this.supportsText ? " supports(" + this.supportsText + ")" : "" ) + (mediaText ? " " + mediaText : "") + ";";
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
Object.defineProperty(CSSOM.CSSImportRule.prototype, "href", {
|
|
42
|
+
get: function() {
|
|
43
|
+
return this.__href;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
Object.defineProperty(CSSOM.CSSImportRule.prototype, "media", {
|
|
48
|
+
get: function() {
|
|
49
|
+
return this.__media;
|
|
36
50
|
},
|
|
37
|
-
|
|
51
|
+
set: function(value) {
|
|
52
|
+
if (typeof value === "string") {
|
|
53
|
+
this.__media.mediaText = value;
|
|
54
|
+
} else {
|
|
55
|
+
this.__media = value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
Object.defineProperty(CSSOM.CSSImportRule.prototype, "layerName", {
|
|
61
|
+
get: function() {
|
|
62
|
+
return this.__layerName;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
Object.defineProperty(CSSOM.CSSImportRule.prototype, "supportsText", {
|
|
67
|
+
get: function() {
|
|
68
|
+
return this.__supportsText;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
Object.defineProperty(CSSOM.CSSImportRule.prototype, "styleSheet", {
|
|
73
|
+
get: function() {
|
|
74
|
+
return this.__styleSheet;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* NON-STANDARD
|
|
80
|
+
* Rule text parser.
|
|
81
|
+
* @param {string} cssText
|
|
82
|
+
*/
|
|
83
|
+
Object.defineProperty(CSSOM.CSSImportRule.prototype, "parse", {
|
|
84
|
+
value: function(cssText) {
|
|
38
85
|
var i = 0;
|
|
39
86
|
|
|
40
87
|
/**
|
|
@@ -213,43 +260,6 @@ Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
|
|
|
213
260
|
}
|
|
214
261
|
});
|
|
215
262
|
|
|
216
|
-
Object.defineProperty(CSSOM.CSSImportRule.prototype, "href", {
|
|
217
|
-
get: function() {
|
|
218
|
-
return this.__href;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
Object.defineProperty(CSSOM.CSSImportRule.prototype, "media", {
|
|
223
|
-
get: function() {
|
|
224
|
-
return this.__media;
|
|
225
|
-
},
|
|
226
|
-
set: function(value) {
|
|
227
|
-
if (typeof value === "string") {
|
|
228
|
-
this.__media.mediaText = value;
|
|
229
|
-
} else {
|
|
230
|
-
this.__media = value;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
Object.defineProperty(CSSOM.CSSImportRule.prototype, "layerName", {
|
|
236
|
-
get: function() {
|
|
237
|
-
return this.__layerName;
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
Object.defineProperty(CSSOM.CSSImportRule.prototype, "supportsText", {
|
|
242
|
-
get: function() {
|
|
243
|
-
return this.__supportsText;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
Object.defineProperty(CSSOM.CSSImportRule.prototype, "styleSheet", {
|
|
248
|
-
get: function() {
|
|
249
|
-
return this.__styleSheet;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
|
|
253
263
|
|
|
254
264
|
//.CommonJS
|
|
255
265
|
exports.CSSImportRule = CSSOM.CSSImportRule;
|
package/lib/CSSKeyframeRule.js
CHANGED
|
@@ -23,9 +23,16 @@ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
|
|
|
23
23
|
this.__style.parentRule = this;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
CSSOM.CSSKeyframeRule.prototype =
|
|
26
|
+
CSSOM.CSSKeyframeRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
27
27
|
CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
Object.setPrototypeOf(CSSOM.CSSKeyframeRule, CSSOM.CSSRule);
|
|
30
|
+
|
|
31
|
+
Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "type", {
|
|
32
|
+
value: 8,
|
|
33
|
+
writable: false
|
|
34
|
+
});
|
|
35
|
+
|
|
29
36
|
//FIXME
|
|
30
37
|
//CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
|
|
31
38
|
//CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
|
package/lib/CSSKeyframesRule.js
CHANGED
|
@@ -49,9 +49,15 @@ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
CSSOM.CSSKeyframesRule.prototype =
|
|
52
|
+
CSSOM.CSSKeyframesRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
53
53
|
CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
Object.setPrototypeOf(CSSOM.CSSKeyframesRule, CSSOM.CSSRule);
|
|
56
|
+
|
|
57
|
+
Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "type", {
|
|
58
|
+
value: 7,
|
|
59
|
+
writable: false
|
|
60
|
+
});
|
|
55
61
|
|
|
56
62
|
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
|
|
57
63
|
Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
|
package/lib/CSSLayerBlockRule.js
CHANGED
|
@@ -15,9 +15,15 @@ CSSOM.CSSLayerBlockRule = function CSSLayerBlockRule() {
|
|
|
15
15
|
this.name = "";
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
CSSOM.CSSLayerBlockRule.prototype =
|
|
18
|
+
CSSOM.CSSLayerBlockRule.prototype = Object.create(CSSOM.CSSGroupingRule.prototype);
|
|
19
19
|
CSSOM.CSSLayerBlockRule.prototype.constructor = CSSOM.CSSLayerBlockRule;
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
Object.setPrototypeOf(CSSOM.CSSLayerBlockRule, CSSOM.CSSRule);
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(CSSOM.CSSLayerBlockRule.prototype, "type", {
|
|
24
|
+
value: 18,
|
|
25
|
+
writable: false
|
|
26
|
+
});
|
|
21
27
|
|
|
22
28
|
Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, {
|
|
23
29
|
cssText: {
|
|
@@ -34,9 +40,7 @@ Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, {
|
|
|
34
40
|
}
|
|
35
41
|
values = valuesArr.join("\n ") + "\n}";
|
|
36
42
|
return "@layer" + (this.name ? " " + this.name : "") + values;
|
|
37
|
-
}
|
|
38
|
-
configurable: true,
|
|
39
|
-
enumerable: true,
|
|
43
|
+
}
|
|
40
44
|
},
|
|
41
45
|
});
|
|
42
46
|
|
|
@@ -13,17 +13,21 @@ CSSOM.CSSLayerStatementRule = function CSSLayerStatementRule() {
|
|
|
13
13
|
this.nameList = [];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
CSSOM.CSSLayerStatementRule.prototype =
|
|
16
|
+
CSSOM.CSSLayerStatementRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
17
17
|
CSSOM.CSSLayerStatementRule.prototype.constructor = CSSOM.CSSLayerStatementRule;
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
Object.setPrototypeOf(CSSOM.CSSLayerStatementRule, CSSOM.CSSRule);
|
|
20
|
+
|
|
21
|
+
Object.defineProperty(CSSOM.CSSLayerStatementRule.prototype, "type", {
|
|
22
|
+
value: 0,
|
|
23
|
+
writable: false
|
|
24
|
+
});
|
|
19
25
|
|
|
20
26
|
Object.defineProperties(CSSOM.CSSLayerStatementRule.prototype, {
|
|
21
27
|
cssText: {
|
|
22
28
|
get: function () {
|
|
23
29
|
return "@layer " + this.nameList.join(", ") + ";";
|
|
24
|
-
}
|
|
25
|
-
configurable: true,
|
|
26
|
-
enumerable: true,
|
|
30
|
+
}
|
|
27
31
|
},
|
|
28
32
|
});
|
|
29
33
|
|
package/lib/CSSMediaRule.js
CHANGED
|
@@ -19,9 +19,15 @@ CSSOM.CSSMediaRule = function CSSMediaRule() {
|
|
|
19
19
|
this.__media = new CSSOM.MediaList();
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
CSSOM.CSSMediaRule.prototype =
|
|
22
|
+
CSSOM.CSSMediaRule.prototype = Object.create(CSSOM.CSSConditionRule.prototype);
|
|
23
23
|
CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
Object.setPrototypeOf(CSSOM.CSSMediaRule, CSSOM.CSSConditionRule);
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(CSSOM.CSSMediaRule.prototype, "type", {
|
|
28
|
+
value: 4,
|
|
29
|
+
writable: false
|
|
30
|
+
});
|
|
25
31
|
|
|
26
32
|
// https://opensource.apple.com/source/WebCore/WebCore-7611.1.21.161.3/css/CSSMediaRule.cpp
|
|
27
33
|
Object.defineProperties(CSSOM.CSSMediaRule.prototype, {
|
|
@@ -57,9 +63,7 @@ Object.defineProperties(CSSOM.CSSMediaRule.prototype, {
|
|
|
57
63
|
}
|
|
58
64
|
values = valuesArr.join("\n ") + "\n}";
|
|
59
65
|
return "@media " + this.media.mediaText + values;
|
|
60
|
-
}
|
|
61
|
-
configurable: true,
|
|
62
|
-
enumerable: true
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
});
|
|
65
69
|
|
package/lib/CSSNamespaceRule.js
CHANGED
|
@@ -16,19 +16,42 @@ CSSOM.CSSNamespaceRule = function CSSNamespaceRule() {
|
|
|
16
16
|
this.__namespaceURI = "";
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
CSSOM.CSSNamespaceRule.prototype =
|
|
19
|
+
CSSOM.CSSNamespaceRule.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
20
20
|
CSSOM.CSSNamespaceRule.prototype.constructor = CSSOM.CSSNamespaceRule;
|
|
21
21
|
|
|
22
|
+
Object.setPrototypeOf(CSSOM.CSSNamespaceRule, CSSOM.CSSRule);
|
|
23
|
+
|
|
22
24
|
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "type", {
|
|
23
25
|
value: 10,
|
|
24
|
-
|
|
26
|
+
writable: false
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "cssText", {
|
|
28
30
|
get: function() {
|
|
29
31
|
return "@namespace" + (this.prefix && " " + this.prefix) + " url(\"" + this.namespaceURI + "\");";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "prefix", {
|
|
36
|
+
get: function() {
|
|
37
|
+
return this.__prefix;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "namespaceURI", {
|
|
42
|
+
get: function() {
|
|
43
|
+
return this.__namespaceURI;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* NON-STANDARD
|
|
50
|
+
* Rule text parser.
|
|
51
|
+
* @param {string} cssText
|
|
52
|
+
*/
|
|
53
|
+
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "parse", {
|
|
54
|
+
value: function(cssText) {
|
|
32
55
|
var newPrefix = "";
|
|
33
56
|
var newNamespaceURI = "";
|
|
34
57
|
|
|
@@ -75,19 +98,6 @@ Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "cssText", {
|
|
|
75
98
|
}
|
|
76
99
|
}
|
|
77
100
|
});
|
|
78
|
-
|
|
79
|
-
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "prefix", {
|
|
80
|
-
get: function() {
|
|
81
|
-
return this.__prefix;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
Object.defineProperty(CSSOM.CSSNamespaceRule.prototype, "namespaceURI", {
|
|
86
|
-
get: function() {
|
|
87
|
-
return this.__namespaceURI;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
101
|
//.CommonJS
|
|
92
102
|
exports.CSSNamespaceRule = CSSOM.CSSNamespaceRule;
|
|
93
103
|
///CommonJS
|
|
@@ -22,9 +22,15 @@ CSSOM.CSSNestedDeclarations = function CSSNestedDeclarations() {
|
|
|
22
22
|
this.__style.parentRule = this;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
CSSOM.CSSNestedDeclarations.prototype =
|
|
25
|
+
CSSOM.CSSNestedDeclarations.prototype = Object.create(CSSOM.CSSRule.prototype);
|
|
26
26
|
CSSOM.CSSNestedDeclarations.prototype.constructor = CSSOM.CSSNestedDeclarations;
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
Object.setPrototypeOf(CSSOM.CSSNestedDeclarations, CSSOM.CSSRule);
|
|
29
|
+
|
|
30
|
+
Object.defineProperty(CSSOM.CSSNestedDeclarations.prototype, "type", {
|
|
31
|
+
value: 0,
|
|
32
|
+
writable: false
|
|
33
|
+
});
|
|
28
34
|
|
|
29
35
|
Object.defineProperty(CSSOM.CSSNestedDeclarations.prototype, "style", {
|
|
30
36
|
get: function() {
|
|
@@ -42,9 +48,7 @@ Object.defineProperty(CSSOM.CSSNestedDeclarations.prototype, "style", {
|
|
|
42
48
|
Object.defineProperty(CSSOM.CSSNestedDeclarations.prototype, "cssText", {
|
|
43
49
|
get: function () {
|
|
44
50
|
return this.style.cssText;
|
|
45
|
-
}
|
|
46
|
-
configurable: true,
|
|
47
|
-
enumerable: true,
|
|
51
|
+
}
|
|
48
52
|
});
|
|
49
53
|
|
|
50
54
|
//.CommonJS
|
package/lib/CSSOM.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __globalObject = null;
|
|
2
2
|
|
|
3
|
+
var CSSOM = {
|
|
4
|
+
setup: function(opts) {
|
|
5
|
+
if (opts.globalObject) {
|
|
6
|
+
__globalObject = opts.globalObject;
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
getGlobalObject: function() {
|
|
10
|
+
return __globalObject;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//.CommonJS
|
|
15
|
+
exports.setup = CSSOM.setup;
|
|
16
|
+
exports.getGlobalObject = CSSOM.getGlobalObject;
|
|
17
|
+
///CommonJS
|
|
3
18
|
|