UNPKG

1.18 kBJavaScriptView Raw
1//.CommonJS
2var CSSOM = {
3 CSSRule: require("./CSSRule").CSSRule
4};
5///CommonJS
6
7
8/**
9 * @constructor
10 * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule
11 */
12CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
13 CSSOM.CSSRule.call(this);
14 this.name = '';
15 this.cssRules = [];
16};
17
18CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
19CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
20CSSOM.CSSKeyframesRule.prototype.type = 7;
21//FIXME
22//CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
23//CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
24
25// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
26Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
27 get: function() {
28 var cssTexts = [];
29 for (var i=0, length=this.cssRules.length; i < length; i++) {
30 cssTexts.push(" " + this.cssRules[i].cssText);
31 }
32 return "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
33 }
34});
35
36
37//.CommonJS
38exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;
39///CommonJS