CSSKeyframesRule Redirect 1

« CSSKeyframesRule

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

The CSSKeyframesRule interface describes an object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE).

Syntax

The syntax is described using the WebIDL format.

interface CSSKeyframesRule : CSSRule {
           attribute DOMString   name;
  readonly attribute CSSRuleList cssRules;

  void            appendRule(in DOMString rule);
  void            deleteRule(in DOMString key);
  CSSKeyframeRule findRule(in DOMString key);
};

Properties

As a CSSRule, CSSKeyframesRule also implements the properties of these interfaces. It has two properties :

CSSPageRule.name
Represents the name of the animation, used by the animation-name property.
CSSPageRule.cssRules Read only
Returns a CSSRuleList of the CSS rules in the media rule.

Methods

As a CSSRule, CSSKeyframesRule also implements the methods of that interface. It has three specific methods:

CSSPageRule.appendRule
Inserts a new keyframe rule into the current CSSKeyframesRule. The parameter is a DOMString containing a keyframe in the same format as an entry of a @keyframes at-rule. If it contains more than one keyframe rule, a DOMException with a SYNTAX_ERR is thrown.
CSSPageRule.deleteRule
Deletes a keyframe rule from the current CSSKeyframesRule. The parameter is the index of the keyframe to be deleted, expressed as a DOMString resolving as a number between 0 and 1.
CSSPageRule.findRule
Returns a keyframe rule corresponding to the given key. The key is a DOMString containing an index of the keyframe o be returned, resolving to a number between 0 and 1. If no such keyframe exists, findRule returns null.

Specification

Specification Status Comment
CSS Animations Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 5.0 (5.0) 10 12 -o
12.10 #
4.0
appendRule (Yes) with the non-standard name insertRule 5.0 (5.0) with the non-standard name insertRule
22.0 (22.0)
 
10 with the non-standard name insertRule (Yes) with the non-standard name insertRule (Yes) with the non-standard name insertRule
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) 5.0 (5.0) (Yes) 12 -o
12.10
(Yes)
appendRule (Yes) with the non-standard name insertRule 5.0 (5.0) as insertRule
22.0 (22.0)
(Yes) with the non-standard name insertRule (Yes) with the non-standard name insertRule (Yes) with the non-standard name insertRule

See also

Document Tags and Contributors

Last updated by: Sheppy,