W3C home > Mailing lists > Public > www-style@w3.org > March 2011

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

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 30 Mar 2011 15:06:56 -0700
To: www-style@w3.org
Message-ID: <20110330220656.GA8950@pickering.dbaron.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:38 GMT