CSSSupportsRule.js
1 //.CommonJS 2 var CSSOM = { 3 CSSRule: require("./CSSRule").CSSRule, 4 }; 5 ///CommonJS 6 7 8 /** 9 * @constructor 10 * @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface 11 */ 12 CSSOM.CSSSupportsRule = function CSSSupportsRule() { 13 CSSOM.CSSRule.call(this); 14 this.conditionText = ''; 15 this.cssRules = []; 16 }; 17 18 CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSRule(); 19 CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule; 20 CSSOM.CSSSupportsRule.prototype.type = 12; 21 22 Object.defineProperty(CSSOM.CSSSupportsRule.prototype, "cssText", { 23 get: function() { 24 var cssTexts = []; 25 26 for (var i = 0, length = this.cssRules.length; i < length; i++) { 27 cssTexts.push(this.cssRules[i].cssText); 28 } 29 30 return "@supports " + this.conditionText + " {" + cssTexts.join("") + "}"; 31 } 32 }); 33 34 //.CommonJS 35 exports.CSSSupportsRule = CSSOM.CSSSupportsRule; 36 ///CommonJS