CSSHostRule.js
 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