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

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

From: Simon Fraser <smfr@me.com>
Date: Wed, 30 Mar 2011 15:25:53 -0700
Cc: www-style@w3.org
Message-id: <D99A0F68-E9E6-4CCA-B16E-E55C9C97F7E0@me.com>
To: "L. David Baron" <dbaron@dbaron.org>
On Mar 30, 2011, at 3:06 PM, L. David Baron wrote:

> 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.

This doesn't help if the author wants to manage the various states
of their elements with non-inline style, though. If we add API, I think
we should add something that allows authors to run transitions whose
states are described by non-inline style.

Received on Wednesday, 30 March 2011 22:26:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:44 UTC