CSSLayerBlockRule.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule,
  4. CSSRuleList: require("./CSSRuleList").CSSRuleList,
  5. CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
  6. };
  7. ///CommonJS
  8. /**
  9. * @constructor
  10. * @see https://drafts.csswg.org/css-cascade-5/#csslayerblockrule
  11. */
  12. CSSOM.CSSLayerBlockRule = function CSSLayerBlockRule() {
  13. CSSOM.CSSGroupingRule.call(this);
  14. this.name = "";
  15. };
  16. CSSOM.CSSLayerBlockRule.prototype = Object.create(CSSOM.CSSGroupingRule.prototype);
  17. CSSOM.CSSLayerBlockRule.prototype.constructor = CSSOM.CSSLayerBlockRule;
  18. Object.setPrototypeOf(CSSOM.CSSLayerBlockRule, CSSOM.CSSRule);
  19. Object.defineProperty(CSSOM.CSSLayerBlockRule.prototype, "type", {
  20. value: 18,
  21. writable: false
  22. });
  23. Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, {
  24. cssText: {
  25. get: function () {
  26. var values = "";
  27. var valuesArr = [" {"];
  28. if (this.cssRules.length) {
  29. valuesArr.push(this.cssRules.reduce(function(acc, rule){
  30. if (rule.cssText !== "") {
  31. acc.push(rule.cssText);
  32. }
  33. return acc;
  34. }, []).join("\n "));
  35. }
  36. values = valuesArr.join("\n ") + "\n}";
  37. return "@layer" + (this.name ? " " + this.name : "") + values;
  38. }
  39. },
  40. });
  41. //.CommonJS
  42. exports.CSSLayerBlockRule = CSSOM.CSSLayerBlockRule;
  43. ///CommonJS