You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

  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