@acemir/cssom 0.9.0

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.
@@ -0,0 +1,25 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see https://www.w3.org/TR/css-conditional-3/#the-cssconditionrule-interface
12
+ */
13
+ CSSOM.CSSConditionRule = function CSSConditionRule() {
14
+ CSSOM.CSSGroupingRule.call(this);
15
+ this.cssRules = [];
16
+ };
17
+
18
+ CSSOM.CSSConditionRule.prototype = new CSSOM.CSSGroupingRule();
19
+ CSSOM.CSSConditionRule.prototype.constructor = CSSOM.CSSConditionRule;
20
+ CSSOM.CSSConditionRule.prototype.conditionText = ''
21
+ CSSOM.CSSConditionRule.prototype.cssText = ''
22
+
23
+ //.CommonJS
24
+ exports.CSSConditionRule = CSSOM.CSSConditionRule;
25
+ ///CommonJS
@@ -0,0 +1,50 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
5
+ CSSConditionRule: require("./CSSConditionRule").CSSConditionRule,
6
+ };
7
+ ///CommonJS
8
+
9
+
10
+ /**
11
+ * @constructor
12
+ * @see https://drafts.csswg.org/css-contain-3/
13
+ * @see https://www.w3.org/TR/css-contain-3/
14
+ */
15
+ CSSOM.CSSContainerRule = function CSSContainerRule() {
16
+ CSSOM.CSSConditionRule.call(this);
17
+ };
18
+
19
+ CSSOM.CSSContainerRule.prototype = new CSSOM.CSSConditionRule();
20
+ CSSOM.CSSContainerRule.prototype.constructor = CSSOM.CSSContainerRule;
21
+ CSSOM.CSSContainerRule.prototype.type = 17;
22
+
23
+ Object.defineProperties(CSSOM.CSSContainerRule.prototype, {
24
+ "conditionText": {
25
+ get: function() {
26
+ return this.containerText;
27
+ },
28
+ set: function(value) {
29
+ this.containerText = value;
30
+ },
31
+ configurable: true,
32
+ enumerable: true
33
+ },
34
+ "cssText": {
35
+ get: function() {
36
+ var cssTexts = [];
37
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
38
+ cssTexts.push(this.cssRules[i].cssText);
39
+ }
40
+ return "@container " + this.containerText + " {" + cssTexts.join("") + "}";
41
+ },
42
+ configurable: true,
43
+ enumerable: true
44
+ }
45
+ });
46
+
47
+
48
+ //.CommonJS
49
+ exports.CSSContainerRule = CSSOM.CSSContainerRule;
50
+ ///CommonJS
@@ -0,0 +1,39 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ MatcherList: require("./MatcherList").MatcherList
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see https://developer.mozilla.org/en/CSS/@-moz-document
12
+ */
13
+ CSSOM.CSSDocumentRule = function CSSDocumentRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.matcher = new CSSOM.MatcherList();
16
+ this.cssRules = [];
17
+ };
18
+
19
+ CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();
20
+ CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
21
+ CSSOM.CSSDocumentRule.prototype.type = 10;
22
+ //FIXME
23
+ //CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
24
+ //CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
25
+
26
+ Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", {
27
+ get: function() {
28
+ var cssTexts = [];
29
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
30
+ cssTexts.push(this.cssRules[i].cssText);
31
+ }
32
+ return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}";
33
+ }
34
+ });
35
+
36
+
37
+ //.CommonJS
38
+ exports.CSSDocumentRule = CSSOM.CSSDocumentRule;
39
+ ///CommonJS
@@ -0,0 +1,36 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
4
+ CSSRule: require("./CSSRule").CSSRule
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see http://dev.w3.org/csswg/cssom/#css-font-face-rule
12
+ */
13
+ CSSOM.CSSFontFaceRule = function CSSFontFaceRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.style = new CSSOM.CSSStyleDeclaration();
16
+ this.style.parentRule = this;
17
+ };
18
+
19
+ CSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule();
20
+ CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;
21
+ CSSOM.CSSFontFaceRule.prototype.type = 5;
22
+ //FIXME
23
+ //CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
24
+ //CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
25
+
26
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSFontFaceRule.cpp
27
+ Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "cssText", {
28
+ get: function() {
29
+ return "@font-face {" + this.style.cssText + "}";
30
+ }
31
+ });
32
+
33
+
34
+ //.CommonJS
35
+ exports.CSSFontFaceRule = CSSOM.CSSFontFaceRule;
36
+ ///CommonJS
@@ -0,0 +1,69 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ parse: require('./parse').parse
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface
12
+ */
13
+ CSSOM.CSSGroupingRule = function CSSGroupingRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.cssRules = [];
16
+ };
17
+
18
+ CSSOM.CSSGroupingRule.prototype = new CSSOM.CSSRule();
19
+ CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
20
+
21
+
22
+ /**
23
+ * Used to insert a new CSS rule to a list of CSS rules.
24
+ *
25
+ * @example
26
+ * cssGroupingRule.cssText
27
+ * -> "body{margin:0;}"
28
+ * cssGroupingRule.insertRule("img{border:none;}", 1)
29
+ * -> 1
30
+ * cssGroupingRule.cssText
31
+ * -> "body{margin:0;}img{border:none;}"
32
+ *
33
+ * @param {string} rule
34
+ * @param {number} [index]
35
+ * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-insertrule
36
+ * @return {number} The index within the grouping rule's collection of the newly inserted rule.
37
+ */
38
+ CSSOM.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index) {
39
+ if (index < 0 || index > this.cssRules.length) {
40
+ throw new RangeError("INDEX_SIZE_ERR");
41
+ }
42
+ var cssRule = CSSOM.parse(rule).cssRules[0];
43
+ cssRule.parentRule = this;
44
+ this.cssRules.splice(index, 0, cssRule);
45
+ return index;
46
+ };
47
+
48
+ /**
49
+ * Used to delete a rule from the grouping rule.
50
+ *
51
+ * cssGroupingRule.cssText
52
+ * -> "img{border:none;}body{margin:0;}"
53
+ * cssGroupingRule.deleteRule(0)
54
+ * cssGroupingRule.cssText
55
+ * -> "body{margin:0;}"
56
+ *
57
+ * @param {number} index within the grouping rule's rule list of the rule to remove.
58
+ * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-deleterule
59
+ */
60
+ CSSOM.CSSGroupingRule.prototype.deleteRule = function deleteRule(index) {
61
+ if (index < 0 || index >= this.cssRules.length) {
62
+ throw new RangeError("INDEX_SIZE_ERR");
63
+ }
64
+ this.cssRules.splice(index, 1)[0].parentRule = null;
65
+ };
66
+
67
+ //.CommonJS
68
+ exports.CSSGroupingRule = CSSOM.CSSGroupingRule;
69
+ ///CommonJS
@@ -0,0 +1,37 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule
4
+ };
5
+ ///CommonJS
6
+
7
+
8
+ /**
9
+ * @constructor
10
+ * @see http://www.w3.org/TR/shadow-dom/#host-at-rule
11
+ */
12
+ CSSOM.CSSHostRule = function CSSHostRule() {
13
+ CSSOM.CSSRule.call(this);
14
+ this.cssRules = [];
15
+ };
16
+
17
+ CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
18
+ CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
19
+ CSSOM.CSSHostRule.prototype.type = 1001;
20
+ //FIXME
21
+ //CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
22
+ //CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
23
+
24
+ Object.defineProperty(CSSOM.CSSHostRule.prototype, "cssText", {
25
+ get: function() {
26
+ var cssTexts = [];
27
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
28
+ cssTexts.push(this.cssRules[i].cssText);
29
+ }
30
+ return "@host {" + cssTexts.join("") + "}";
31
+ }
32
+ });
33
+
34
+
35
+ //.CommonJS
36
+ exports.CSSHostRule = CSSOM.CSSHostRule;
37
+ ///CommonJS
@@ -0,0 +1,132 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
5
+ MediaList: require("./MediaList").MediaList
6
+ };
7
+ ///CommonJS
8
+
9
+
10
+ /**
11
+ * @constructor
12
+ * @see http://dev.w3.org/csswg/cssom/#cssimportrule
13
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSImportRule
14
+ */
15
+ CSSOM.CSSImportRule = function CSSImportRule() {
16
+ CSSOM.CSSRule.call(this);
17
+ this.href = "";
18
+ this.media = new CSSOM.MediaList();
19
+ this.styleSheet = new CSSOM.CSSStyleSheet();
20
+ };
21
+
22
+ CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule();
23
+ CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
24
+ CSSOM.CSSImportRule.prototype.type = 3;
25
+
26
+ Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
27
+ get: function() {
28
+ var mediaText = this.media.mediaText;
29
+ return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";";
30
+ },
31
+ set: function(cssText) {
32
+ var i = 0;
33
+
34
+ /**
35
+ * @import url(partial.css) screen, handheld;
36
+ * || |
37
+ * after-import media
38
+ * |
39
+ * url
40
+ */
41
+ var state = '';
42
+
43
+ var buffer = '';
44
+ var index;
45
+ for (var character; (character = cssText.charAt(i)); i++) {
46
+
47
+ switch (character) {
48
+ case ' ':
49
+ case '\t':
50
+ case '\r':
51
+ case '\n':
52
+ case '\f':
53
+ if (state === 'after-import') {
54
+ state = 'url';
55
+ } else {
56
+ buffer += character;
57
+ }
58
+ break;
59
+
60
+ case '@':
61
+ if (!state && cssText.indexOf('@import', i) === i) {
62
+ state = 'after-import';
63
+ i += 'import'.length;
64
+ buffer = '';
65
+ }
66
+ break;
67
+
68
+ case 'u':
69
+ if (state === 'url' && cssText.indexOf('url(', i) === i) {
70
+ index = cssText.indexOf(')', i + 1);
71
+ if (index === -1) {
72
+ throw i + ': ")" not found';
73
+ }
74
+ i += 'url('.length;
75
+ var url = cssText.slice(i, index);
76
+ if (url[0] === url[url.length - 1]) {
77
+ if (url[0] === '"' || url[0] === "'") {
78
+ url = url.slice(1, -1);
79
+ }
80
+ }
81
+ this.href = url;
82
+ i = index;
83
+ state = 'media';
84
+ }
85
+ break;
86
+
87
+ case '"':
88
+ if (state === 'url') {
89
+ index = cssText.indexOf('"', i + 1);
90
+ if (!index) {
91
+ throw i + ": '\"' not found";
92
+ }
93
+ this.href = cssText.slice(i + 1, index);
94
+ i = index;
95
+ state = 'media';
96
+ }
97
+ break;
98
+
99
+ case "'":
100
+ if (state === 'url') {
101
+ index = cssText.indexOf("'", i + 1);
102
+ if (!index) {
103
+ throw i + ': "\'" not found';
104
+ }
105
+ this.href = cssText.slice(i + 1, index);
106
+ i = index;
107
+ state = 'media';
108
+ }
109
+ break;
110
+
111
+ case ';':
112
+ if (state === 'media') {
113
+ if (buffer) {
114
+ this.media.mediaText = buffer.trim();
115
+ }
116
+ }
117
+ break;
118
+
119
+ default:
120
+ if (state === 'media') {
121
+ buffer += character;
122
+ }
123
+ break;
124
+ }
125
+ }
126
+ }
127
+ });
128
+
129
+
130
+ //.CommonJS
131
+ exports.CSSImportRule = CSSOM.CSSImportRule;
132
+ ///CommonJS
@@ -0,0 +1,37 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSStyleDeclaration: require('./CSSStyleDeclaration').CSSStyleDeclaration
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframeRule
12
+ */
13
+ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.keyText = '';
16
+ this.style = new CSSOM.CSSStyleDeclaration();
17
+ this.style.parentRule = this;
18
+ };
19
+
20
+ CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();
21
+ CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
22
+ CSSOM.CSSKeyframeRule.prototype.type = 8;
23
+ //FIXME
24
+ //CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
25
+ //CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
26
+
27
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframeRule.cpp
28
+ Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "cssText", {
29
+ get: function() {
30
+ return this.keyText + " {" + this.style.cssText + "} ";
31
+ }
32
+ });
33
+
34
+
35
+ //.CommonJS
36
+ exports.CSSKeyframeRule = CSSOM.CSSKeyframeRule;
37
+ ///CommonJS
@@ -0,0 +1,39 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule
4
+ };
5
+ ///CommonJS
6
+
7
+
8
+ /**
9
+ * @constructor
10
+ * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule
11
+ */
12
+ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
13
+ CSSOM.CSSRule.call(this);
14
+ this.name = '';
15
+ this.cssRules = [];
16
+ };
17
+
18
+ CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
19
+ CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
20
+ CSSOM.CSSKeyframesRule.prototype.type = 7;
21
+ //FIXME
22
+ //CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
23
+ //CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
24
+
25
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
26
+ Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
27
+ get: function() {
28
+ var cssTexts = [];
29
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
30
+ cssTexts.push(" " + this.cssRules[i].cssText);
31
+ }
32
+ return "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
33
+ }
34
+ });
35
+
36
+
37
+ //.CommonJS
38
+ exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;
39
+ ///CommonJS
@@ -0,0 +1,48 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
5
+ };
6
+ ///CommonJS
7
+
8
+ /**
9
+ * @constructor
10
+ * @see https://drafts.csswg.org/css-cascade-5/#csslayerblockrule
11
+ */
12
+ CSSOM.CSSLayerBlockRule = function CSSLayerBlockRule() {
13
+ CSSOM.CSSGroupingRule.call(this);
14
+ this.layerName = "";
15
+ this.cssRules = [];
16
+ };
17
+
18
+ CSSOM.CSSLayerBlockRule.prototype = new CSSOM.CSSGroupingRule();
19
+ CSSOM.CSSLayerBlockRule.prototype.constructor = CSSOM.CSSLayerBlockRule;
20
+ CSSOM.CSSLayerBlockRule.prototype.type = 18;
21
+
22
+ Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, {
23
+ layerNameText: {
24
+ get: function () {
25
+ return this.layerName;
26
+ },
27
+ set: function (value) {
28
+ this.layerName = value;
29
+ },
30
+ configurable: true,
31
+ enumerable: true,
32
+ },
33
+ cssText: {
34
+ get: function () {
35
+ var cssTexts = [];
36
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
37
+ cssTexts.push(this.cssRules[i].cssText);
38
+ }
39
+ return "@layer " + this.layerNameText + " {" + cssTexts.join("") + "}";
40
+ },
41
+ configurable: true,
42
+ enumerable: true,
43
+ },
44
+ });
45
+
46
+ //.CommonJS
47
+ exports.CSSLayerBlockRule = CSSOM.CSSLayerBlockRule;
48
+ ///CommonJS
@@ -0,0 +1,53 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
5
+ CSSConditionRule: require("./CSSConditionRule").CSSConditionRule,
6
+ MediaList: require("./MediaList").MediaList
7
+ };
8
+ ///CommonJS
9
+
10
+
11
+ /**
12
+ * @constructor
13
+ * @see http://dev.w3.org/csswg/cssom/#cssmediarule
14
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule
15
+ */
16
+ CSSOM.CSSMediaRule = function CSSMediaRule() {
17
+ CSSOM.CSSConditionRule.call(this);
18
+ this.media = new CSSOM.MediaList();
19
+ };
20
+
21
+ CSSOM.CSSMediaRule.prototype = new CSSOM.CSSConditionRule();
22
+ CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
23
+ CSSOM.CSSMediaRule.prototype.type = 4;
24
+
25
+ // https://opensource.apple.com/source/WebCore/WebCore-7611.1.21.161.3/css/CSSMediaRule.cpp
26
+ Object.defineProperties(CSSOM.CSSMediaRule.prototype, {
27
+ "conditionText": {
28
+ get: function() {
29
+ return this.media.mediaText;
30
+ },
31
+ set: function(value) {
32
+ this.media.mediaText = value;
33
+ },
34
+ configurable: true,
35
+ enumerable: true
36
+ },
37
+ "cssText": {
38
+ get: function() {
39
+ var cssTexts = [];
40
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
41
+ cssTexts.push(this.cssRules[i].cssText);
42
+ }
43
+ return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}";
44
+ },
45
+ configurable: true,
46
+ enumerable: true
47
+ }
48
+ });
49
+
50
+
51
+ //.CommonJS
52
+ exports.CSSMediaRule = CSSOM.CSSMediaRule;
53
+ ///CommonJS
@@ -0,0 +1,31 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ };
5
+ ///CommonJS
6
+
7
+ /**
8
+ * @constructor
9
+ * @see https://drafts.csswg.org/css-nesting-1/
10
+ */
11
+ CSSOM.CSSNestedDeclarations = function CSSNestedDeclarations() {
12
+ CSSOM.CSSRule.call(this);
13
+ this.style = new CSSOM.CSSStyleDeclaration();
14
+ this.style.parentRule = this;
15
+ };
16
+
17
+ CSSOM.CSSNestedDeclarations.prototype = new CSSOM.CSSRule();
18
+ CSSOM.CSSNestedDeclarations.prototype.constructor = CSSOM.CSSNestedDeclarations;
19
+ CSSOM.CSSNestedDeclarations.prototype.type = 0;
20
+
21
+ Object.defineProperty(CSSOM.CSSNestedDeclarations.prototype, "cssText", {
22
+ get: function () {
23
+ return this.style.cssText;
24
+ },
25
+ configurable: true,
26
+ enumerable: true,
27
+ });
28
+
29
+ //.CommonJS
30
+ exports.CSSNestedDeclarations = CSSOM.CSSNestedDeclarations;
31
+ ///CommonJS
package/lib/CSSOM.js ADDED
@@ -0,0 +1,3 @@
1
+ var CSSOM = {};
2
+
3
+
package/lib/CSSRule.js ADDED
@@ -0,0 +1,42 @@
1
+ //.CommonJS
2
+ var CSSOM = {};
3
+ ///CommonJS
4
+
5
+ /**
6
+ * @constructor
7
+ * @see http://dev.w3.org/csswg/cssom/#the-cssrule-interface
8
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule
9
+ */
10
+ CSSOM.CSSRule = function CSSRule() {
11
+ this.parentRule = null;
12
+ this.parentStyleSheet = null;
13
+ };
14
+
15
+ CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete
16
+ CSSOM.CSSRule.STYLE_RULE = 1;
17
+ CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete
18
+ CSSOM.CSSRule.IMPORT_RULE = 3;
19
+ CSSOM.CSSRule.MEDIA_RULE = 4;
20
+ CSSOM.CSSRule.FONT_FACE_RULE = 5;
21
+ CSSOM.CSSRule.PAGE_RULE = 6;
22
+ CSSOM.CSSRule.KEYFRAMES_RULE = 7;
23
+ CSSOM.CSSRule.KEYFRAME_RULE = 8;
24
+ CSSOM.CSSRule.MARGIN_RULE = 9;
25
+ CSSOM.CSSRule.NAMESPACE_RULE = 10;
26
+ CSSOM.CSSRule.COUNTER_STYLE_RULE = 11;
27
+ CSSOM.CSSRule.SUPPORTS_RULE = 12;
28
+ CSSOM.CSSRule.DOCUMENT_RULE = 13;
29
+ CSSOM.CSSRule.FONT_FEATURE_VALUES_RULE = 14;
30
+ CSSOM.CSSRule.VIEWPORT_RULE = 15;
31
+ CSSOM.CSSRule.REGION_STYLE_RULE = 16;
32
+ CSSOM.CSSRule.CONTAINER_RULE = 17;
33
+ CSSOM.CSSRule.LAYER_BLOCK_RULE = 18;
34
+ CSSOM.CSSRule.STARTING_STYLE_RULE = 1002;
35
+
36
+ CSSOM.CSSRule.prototype = {
37
+ constructor: CSSOM.CSSRule,
38
+ //FIXME
39
+ };
40
+
41
+ exports.CSSRule = CSSOM.CSSRule;
42
+ ///CommonJS
@@ -0,0 +1,37 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule
4
+ };
5
+ ///CommonJS
6
+
7
+
8
+ /**
9
+ * @constructor
10
+ * @see http://www.w3.org/TR/shadow-dom/#host-at-rule
11
+ */
12
+ CSSOM.CSSStartingStyleRule = function CSSStartingStyleRule() {
13
+ CSSOM.CSSRule.call(this);
14
+ this.cssRules = [];
15
+ };
16
+
17
+ CSSOM.CSSStartingStyleRule.prototype = new CSSOM.CSSRule();
18
+ CSSOM.CSSStartingStyleRule.prototype.constructor = CSSOM.CSSStartingStyleRule;
19
+ CSSOM.CSSStartingStyleRule.prototype.type = 1002;
20
+ //FIXME
21
+ //CSSOM.CSSStartingStyleRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
22
+ //CSSOM.CSSStartingStyleRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
23
+
24
+ Object.defineProperty(CSSOM.CSSStartingStyleRule.prototype, "cssText", {
25
+ get: function() {
26
+ var cssTexts = [];
27
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
28
+ cssTexts.push(this.cssRules[i].cssText);
29
+ }
30
+ return "@starting-style {" + cssTexts.join("") + "}";
31
+ }
32
+ });
33
+
34
+
35
+ //.CommonJS
36
+ exports.CSSStartingStyleRule = CSSOM.CSSStartingStyleRule;
37
+ ///CommonJS