CSSDocumentRule.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule,
  4. MatcherList: require("./MatcherList").MatcherList
  5. };
  6. ///CommonJS
  7. /**
  8. * @constructor
  9. * @see https://developer.mozilla.org/en/CSS/@-moz-document
  10. */
  11. CSSOM.CSSDocumentRule = function CSSDocumentRule() {
  12. CSSOM.CSSRule.call(this);
  13. this.matcher = new CSSOM.MatcherList();
  14. this.cssRules = [];
  15. };
  16. CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();
  17. CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
  18. CSSOM.CSSDocumentRule.prototype.type = 10;
  19. //FIXME
  20. //CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
  21. //CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
  22. Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", {
  23. get: function() {
  24. var cssTexts = [];
  25. for (var i=0, length=this.cssRules.length; i < length; i++) {
  26. cssTexts.push(this.cssRules[i].cssText);
  27. }
  28. return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}";
  29. }
  30. });
  31. //.CommonJS
  32. exports.CSSDocumentRule = CSSOM.CSSDocumentRule;
  33. ///CommonJS