CSSSupportsRule.js 889 B

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