UNPKG

913 BJavaScriptView Raw
1//.CommonJS
2var 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 */
12CSSOM.CSSHostRule = function CSSHostRule() {
13 CSSOM.CSSRule.call(this);
14 this.cssRules = [];
15};
16
17CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
18CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
19CSSOM.CSSHostRule.prototype.type = 1001;
20//FIXME
21//CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
22//CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
23
24Object.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
36exports.CSSHostRule = CSSOM.CSSHostRule;
37///CommonJS