CSSContainerRule.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule,
  4. CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
  5. CSSConditionRule: require("./CSSConditionRule").CSSConditionRule,
  6. };
  7. ///CommonJS
  8. /**
  9. * @constructor
  10. * @see https://drafts.csswg.org/css-contain-3/
  11. * @see https://www.w3.org/TR/css-contain-3/
  12. */
  13. CSSOM.CSSContainerRule = function CSSContainerRule() {
  14. CSSOM.CSSConditionRule.call(this);
  15. };
  16. CSSOM.CSSContainerRule.prototype = new CSSOM.CSSConditionRule();
  17. CSSOM.CSSContainerRule.prototype.constructor = CSSOM.CSSContainerRule;
  18. CSSOM.CSSContainerRule.prototype.type = 17;
  19. Object.defineProperties(CSSOM.CSSContainerRule.prototype, {
  20. "conditionText": {
  21. get: function() {
  22. return this.containerText;
  23. },
  24. set: function(value) {
  25. this.containerText = 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 "@container " + this.containerText + " {" + cssTexts.join("") + "}";
  37. },
  38. configurable: true,
  39. enumerable: true
  40. }
  41. });
  42. //.CommonJS
  43. exports.CSSContainerRule = CSSOM.CSSContainerRule;
  44. ///CommonJS