CSSHostRule.js 913 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule
  4. };
  5. ///CommonJS
  6. /**
  7. * @constructor
  8. * @see http://www.w3.org/TR/shadow-dom/#host-at-rule
  9. */
  10. CSSOM.CSSHostRule = function CSSHostRule() {
  11. CSSOM.CSSRule.call(this);
  12. this.cssRules = [];
  13. };
  14. CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
  15. CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
  16. CSSOM.CSSHostRule.prototype.type = 1001;
  17. //FIXME
  18. //CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
  19. //CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
  20. Object.defineProperty(CSSOM.CSSHostRule.prototype, "cssText", {
  21. get: function() {
  22. var cssTexts = [];
  23. for (var i=0, length=this.cssRules.length; i < length; i++) {
  24. cssTexts.push(this.cssRules[i].cssText);
  25. }
  26. return "@host {" + cssTexts.join("") + "}";
  27. }
  28. });
  29. //.CommonJS
  30. exports.CSSHostRule = CSSOM.CSSHostRule;
  31. ///CommonJS