CSSLayerBlockRule.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule,
  4. CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
  5. };
  6. ///CommonJS
  7. /**
  8. * @constructor
  9. * @see https://drafts.csswg.org/css-cascade-5/#csslayerblockrule
  10. */
  11. CSSOM.CSSLayerBlockRule = function CSSLayerBlockRule() {
  12. CSSOM.CSSGroupingRule.call(this);
  13. this.layerName = "";
  14. this.cssRules = [];
  15. };
  16. CSSOM.CSSLayerBlockRule.prototype = new CSSOM.CSSGroupingRule();
  17. CSSOM.CSSLayerBlockRule.prototype.constructor = CSSOM.CSSLayerBlockRule;
  18. CSSOM.CSSLayerBlockRule.prototype.type = 18;
  19. Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, {
  20. layerNameText: {
  21. get: function () {
  22. return this.layerName;
  23. },
  24. set: function (value) {
  25. this.layerName = value;
  26. },
  27. configurable: true,
  28. enumerable: true,
  29. },
  30. cssText: {
  31. get: function () {
  32. var cssTexts = [];
  33. for (var i = 0, length = this.cssRules.length; i < length; i++) {
  34. cssTexts.push(this.cssRules[i].cssText);
  35. }
  36. return "@layer " + this.layerNameText + " {" + cssTexts.join("") + "}";
  37. },
  38. configurable: true,
  39. enumerable: true,
  40. },
  41. });
  42. //.CommonJS
  43. exports.CSSLayerBlockRule = CSSOM.CSSLayerBlockRule;
  44. ///CommonJS