Abstract
CSS Transitions allows property changes in CSS values to occur smoothly over a specified duration.
CSS is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.
Status of this document
Table of Contents
1. Delta specification
This is a delta specification, meaning that it currently contains
only the differences from CSS Transitions Level 1 [CSS3-TRANSITIONS].
Once the Level 1 specification is closer to complete, it will be merged
with the additions here into a complete level 2 specification.
2. Transition Events
2.1. Types of TransitionEvent
The additional types of transition events that can occur are:
- transitionstart
-
The transitionstart event occurs when a transition is started (i.e., when it is added to the set of running transitions).
- Bubbles: Yes
- Cancelable: No
- Context Info: propertyName, elapsedTime, pseudoElement
- transitioncancel
-
The transitioncancel event occurs when a transition is cancelled.
- Bubbles: Yes
- Cancelable: No
- Context Info: propertyName, elapsedTime, pseudoElement
3. Starting of transitions
Associated with each top-level browsing context is a current transition
generation that is incremented on each style change event.
Each time a new transition is generated, the current value of the (already
incremented) current transition generation is stored as the
transition’s transition generation.
4. Web Animations Instantiation of CSS Animations
TBD. Not sure if we really want a separate 'web animations' section or if we
should do a better job of integrating the two.
4.1. The transition property name
Although the transition-property may specify shorthand properties and the
all keyword, individual transitions are generated for each longhand
sub-property that is animatable. The expanded transition property
name of a transition is the name of the longhand sub-property for which
the transition was generated (e.g. border-left-width).
4.2. Animation priority
The animations generated from the markup and
interfaces (e.g. the CSSTransition
constructor) defined in this
specification have an animation type of ‘CSS Transition’.
CSS Transitions have a lower priority that CSS Animations and
animations without a specific animation type.
Within the set of CSS Transitions, two animations A and B
are sorted in priority order (lowest to highest) as follows:
-
Define the owning element as the element or pseudo-element to
which the transition-property property was applied that generated this
CSS Transition.
If the CSS Transition was generated directly by script (e.g. using
the CSSTransition
constructor) then it has no owning element.
-
If neither A nor B has an owning element,
sort based on A and B such that their animation sequence numbers are in ascending order.
-
Otherwise, if only one of A or B has an owning
element, let the animation with an owning element sort
first.
-
Otherwise, if the owning element of A and B
differs, sort A and B by tree order
of their corresponding owning elements.
With regard to pseudo-elements, the sort order is as follows:
-
element
-
::before
-
::after
-
element children
-
Otherwise, if A and B have different transition
generation values, sort by their corresponding
transition generation in ascending order.
-
Otherwise, sort A and B in ascending order by the
Unicode codepoints that make up the expanded transition property
name of each transition (i.e. without attempting case conversion and
such that ‘-moz-column-width’ sorts before
‘column-width’).
5. DOM Interfaces
5.1. The CSSTransition interface
interface CSSTransition : Animation {
readonly attribute DOMString transitionProperty;
};
-
transitionProperty, of type DOMString, readonly
-
The expanded transition property name of this transition.
TBD: Define a constructor for this
6. Issues deferred from previous levels
We may ultimately want to support a keypath syntax
for the
transition-property property.
A keypath syntax
would enable different transitions
to be specified
for components of a property.
For example
the blur of a shadow
could have
a different transition
than the color of a shadow.
Document conventions
Conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words "MUST",
"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
document are to be interpreted as described in RFC 2119.
However, for readability, these words do not appear in all uppercase
letters in this specification.
All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. [RFC2119]
Examples in this specification are introduced with the words "for example"
or are set apart from the normative text with class="example"
,
like this:
This is an example of an informative example.
Informative notes begin with the word "Note" and are set apart from the
normative text with class="note"
, like this:
Note, this is an informative note.
Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <strong class="advisement">
, like
this:
UAs MUST provide an accessible alternative.
Conformance to this specification
is defined for three conformance classes:
- style sheet
- A CSS
style sheet.
- renderer
- A UA
that interprets the semantics of a style sheet and renders
documents that use them.
- authoring tool
- A UA
that writes a style sheet.
A style sheet is conformant to this specification
if all of its statements that use syntax defined in this module are valid
according to the generic CSS grammar and the individual grammars of each
feature defined in this module.
A renderer is conformant to this specification
if, in addition to interpreting the style sheet as defined by the
appropriate specifications, it supports all the features defined
by this specification by parsing them correctly
and rendering the document accordingly. However, the inability of a
UA to correctly render a document due to limitations of the device
does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.)
An authoring tool is conformant to this specification
if it writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in
this module, and meet all other conformance requirements of style sheets
as described in this module.
Partial implementations
So that authors can exploit the forward-compatible parsing rules to
assign fallback values, CSS renderers must
treat as invalid (and ignore
as appropriate) any at-rules, properties, property values, keywords,
and other syntactic constructs for which they have no usable level of
support. In particular, user agents must not selectively
ignore unsupported component values and honor supported values in a single
multi-value property declaration: if any value is considered invalid
(as unsupported values must be), CSS requires that the entire declaration
be ignored.
Experimental implementations
To avoid clashes with future CSS features, the CSS2.1 specification
reserves a prefixed
syntax for proprietary and experimental extensions to CSS.
Prior to a specification reaching the Candidate Recommendation stage
in the W3C process, all implementations of a CSS feature are considered
experimental. The CSS Working Group recommends that implementations
use a vendor-prefixed syntax for such features, including those in
W3C Working Drafts. This avoids incompatibilities with future changes
in the draft.
Non-experimental implementations
Once a specification reaches the Candidate Recommendation stage,
non-experimental implementations are possible, and implementors should
release an unprefixed implementation of any CR-level feature they
can demonstrate to be correctly implemented according to spec.
To establish and maintain the interoperability of CSS across
implementations, the CSS Working Group requests that non-experimental
CSS renderers submit an implementation report (and, if necessary, the
testcases used for that implementation report) to the W3C before
releasing an unprefixed implementation of any CSS features. Testcases
submitted to W3C are subject to review and correction by the CSS
Working Group.
Further information on submitting testcases and implementation reports
can be found from on the CSS Working Group’s website at
http://www.w3.org/Style/CSS/Test/.
Questions should be directed to the
public-css-testsuite@w3.org
mailing list.
Index
Terms defined by this specification
- CSSTransition, 5.1
- current transition
generation, 3
- expanded transition property
name, 4.1
- owning element, 4.2
- transitioncancel, 2.1
- transition generation, 3
- transitionProperty, 5.1
- transitionstart, 2.1
Terms defined by reference
References
Normative References
- [WebIDL]
- Cameron McCormack. Web IDL. 19 April 2012. CR. URL: http://www.w3.org/TR/WebIDL/
- [CSS-BACKGROUNDS-3]
- CSS Backgrounds and Borders Module Level 3 URL: http://www.w3.org/TR/css3-background/
- [CSS-TRANSITIONS-1]
- CSS Transitions Module Level 1 URL: http://www.w3.org/TR/css3-transitions/
- [CSS3-TRANSITIONS]
- Dean Jackson; et al. CSS Transitions. 19 November 2013. WD. URL: http://www.w3.org/TR/css3-transitions/
- [DOM-LS]
- Document Object Model URL: http://dom.spec.whatwg.org/
- [RFC2119]
- S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
- [WEB-ANIMATIONS]
- Brian Birtles; et al. Web Animations 1.0. 5 June 2014. WD. URL: http://www.w3.org/TR/web-animations/
- [WEB-ANIMATIONS-1]
- Web Animations Level 1 URL: http://www.w3.org/TR/web-animations/
IDL Index
interface CSSTransition : Animation {
readonly attribute DOMString transitionProperty;
};
Issues Index
We may ultimately want to support a keypath syntax
for the
transition-property property.
A keypath syntax
would enable different transitions
to be specified
for components of a property.
For example
the blur of a shadow
could have
a different transition
than the color of a shadow.
↵