CSSKeyframesRule.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule
  4. };
  5. ///CommonJS
  6. /**
  7. * @constructor
  8. * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule
  9. */
  10. CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
  11. CSSOM.CSSRule.call(this);
  12. this.name = '';
  13. this.cssRules = [];
  14. };
  15. CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
  16. CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
  17. CSSOM.CSSKeyframesRule.prototype.type = 8;
  18. //FIXME
  19. //CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
  20. //CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
  21. // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
  22. Object.defineProperty(CSSOM.CSSKeyframesRule.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 "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
  29. }
  30. });
  31. //.CommonJS
  32. exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;
  33. ///CommonJS