[css3-transitions] API to force a transition to start

One thing that I've noticed people wanting to do with transitions is
to do a transition immediately when they create an element.
Currently, there are two workarounds for this:

 * Set the "from" style value, do something that forces a style data
   flush (e.g., calling getComputedStyle), and then set the "to"
   style value.  The repeated flushing of style can be bad for
   performance.

 * Use animations, which can be somewhat heavyweight.

I wonder if it would be useful to add a method like this to
ElementCSSInlineStyle [1]:

  // or maybe called transitionAndSetProperty?
  void transitionStyle(in DOMString property,
                       in DOMString fromValue,
                       in DOMString toValue);

  This method is equivalent to element.style.setProperty(property,
  toValue, ""), except that it additionally causes the transition of
  property that would have resulted if element.style.setProperty(
  property, fromValue, "") had been the previous modification to the
  element's style.

-David

[1] http://dev.w3.org/csswg/cssom/#the-elementcssinlinestyle-interface

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Wednesday, 30 March 2011 22:07:27 UTC