UNPKG

889 BJavaScriptView Raw
1//.CommonJS
2var 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 */
12CSSOM.CSSSupportsRule = function CSSSupportsRule() {
13 CSSOM.CSSRule.call(this);
14 this.conditionText = '';
15 this.cssRules = [];
16};
17
18CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSRule();
19CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;
20CSSOM.CSSSupportsRule.prototype.type = 12;
21
22Object.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
35exports.CSSSupportsRule = CSSOM.CSSSupportsRule;
36///CommonJS