<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>27159</bug_id>
          
          <creation_ts>2009-07-10 14:34:30 -0700</creation_ts>
          <short_desc>Unsetting an object&apos;s transition property to restyle it without animating doesn&apos;t work</short_desc>
          <delta_ts>2022-07-11 16:51:11 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Neven Mrgan">neven.mrgan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andy</cc>
    
    <cc>bfulgham</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>thomas</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>130962</commentid>
    <comment_count>0</comment_count>
      <attachid>32579</attachid>
    <who name="Neven Mrgan">neven.mrgan</who>
    <bug_when>2009-07-10 14:34:30 -0700</bug_when>
    <thetext>Created attachment 32579
Example document

When an object has a transition defined on a property, it would be helpful to be able to change that property without animating. The obvious solution would be to set the object&apos;s transition property to &quot;none&quot;, set the desired properties, then re-set the transition. Unfortunately, because of concurrency or other issues, this method does nothing. As illustrated in the attached example, the object will continue animating even after the transition has been set to &quot;none&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130965</commentid>
    <comment_count>1</comment_count>
    <who name="Neven Mrgan">neven.mrgan</who>
    <bug_when>2009-07-10 14:40:35 -0700</bug_when>
    <thetext>Re-setting the transition property in a timeout - even at 0 ms - will make the setting/unsetting work as expected.

    function moveBack()
    {
    	document.getElementById(&apos;obj&apos;).style.webkitTransition = &apos;none&apos;;
	    document.getElementById(&apos;obj&apos;).style.webkitTransform=&apos;translateX(0px)&apos;;
	    setTimeout(&apos;document.getElementById(&quot;obj&quot;).style.webkitTransition = &quot;-webkit-transform .5s linear&quot;;&apos;, 0);
	    i = 0;
    }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138818</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-08-10 14:17:39 -0700</bug_when>
    <thetext>This doesn&apos;t work because of style batching (which every browser does). The setTimeout is a reasonable workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>138821</commentid>
    <comment_count>3</comment_count>
    <who name="Andy Matuschak">andy</who>
    <bug_when>2009-08-10 14:24:08 -0700</bug_when>
    <thetext>Then can we maybe have some API or some not-so-hideous way of performing an update without going through a transition?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>236650</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew Dupont">webkit</who>
    <bug_when>2010-06-10 19:38:50 -0700</bug_when>
    <thetext>I second Andy&apos;s request.

JavaScript animation libraries often have to chain multiple effects together, and on firing of &quot;webkitTransitionEnd&quot; would need to (a) reset any transition-related style properties; (b) set new values for those same properties for the next effect in the queue.

Currently, (a) and (b) can&apos;t be done together; (b) must be deferred with a &quot;setTimeout&quot; call, at which point the animation library loses the rigid control of timing that is so important to keep things working properly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>236653</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-06-10 19:56:02 -0700</bug_when>
    <thetext>This is expected behavior because of the way that the browser batches style changes. This behavior is common to all the major browsers.

I agree that it can be annoying with transitions, but the alternative would be to force expensive style updates when transition properties change, that we don&apos;t want to do that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>236966</commentid>
    <comment_count>6</comment_count>
    <who name="Andrew Dupont">webkit</who>
    <bug_when>2010-06-11 12:23:04 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; This is expected behavior because of the way that the browser batches style changes. This behavior is common to all the major browsers.
&gt; 
&gt; I agree that it can be annoying with transitions, but the alternative would be to force expensive style updates when transition properties change, that we don&apos;t want to do that.

Simon, I understand as much. I think this will need to be addressed one way or another (and not only in WebKit) as an unintended consequence of how CSS transitions work.

Before now, style batching had no real downside, because:
(a) the order in which style properties were set (within a batch) made no real difference;
(b) no property change behaved in a different way based on the _current value_ of a completely different property.

Anyway, I&apos;m not suggesting that the browser should force expensive style updates by default; it would simply be nice to be able to trigger such an update if you think it&apos;s necessary — or otherwise be able to create your own &quot;batches,&quot; each of which would be applied atomically.

Another option would be a first-class JavaScript interface to transitions and animations, rather than having to set style properties.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>236977</commentid>
    <comment_count>7</comment_count>
    <who name="Thomas Fuchs">thomas</who>
    <bug_when>2010-06-11 12:34:53 -0700</bug_when>
    <thetext>I concur with Andrew that an API call to force the browser to apply style changes would be helpful, for example an &quot;render&quot; call (or some other method name) on the style property of an element.

(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; This is expected behavior because of the way that the browser batches style changes. This behavior is common to all the major browsers.
&gt; &gt; 
&gt; &gt; I agree that it can be annoying with transitions, but the alternative would be to force expensive style updates when transition properties change, that we don&apos;t want to do that.
&gt; 
&gt; Simon, I understand as much. I think this will need to be addressed one way or another (and not only in WebKit) as an unintended consequence of how CSS transitions work.
&gt; 
&gt; Before now, style batching had no real downside, because:
&gt; (a) the order in which style properties were set (within a batch) made no real difference;
&gt; (b) no property change behaved in a different way based on the _current value_ of a completely different property.
&gt; 
&gt; Anyway, I&apos;m not suggesting that the browser should force expensive style updates by default; it would simply be nice to be able to trigger such an update if you think it&apos;s necessary — or otherwise be able to create your own &quot;batches,&quot; each of which would be applied atomically.
&gt; 
&gt; Another option would be a first-class JavaScript interface to transitions and animations, rather than having to set style properties.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>236991</commentid>
    <comment_count>8</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2010-06-11 13:07:46 -0700</bug_when>
    <thetext>Calling document.body.offsetWidth will force a style update and layout, but doing so repeatedly is very expensive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>238035</commentid>
    <comment_count>9</comment_count>
    <who name="Andrew Dupont">webkit</who>
    <bug_when>2010-06-14 14:04:12 -0700</bug_when>
    <thetext>Awesome! That&apos;s good enough for my purposes.

(In reply to comment #8)
&gt; Calling document.body.offsetWidth will force a style update and layout, but doing so repeatedly is very expensive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1882232</commentid>
    <comment_count>10</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-07-11 16:51:11 -0700</bug_when>
    <thetext>Safari, Chrome, and Firefox show the same rendering behavior for this test case. I do not believe any further compatibility issue remains.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>32579</attachid>
            <date>2009-07-10 14:34:30 -0700</date>
            <delta_ts>2009-07-10 14:34:30 -0700</delta_ts>
            <desc>Example document</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>963</size>
            <attacher name="Neven Mrgan">neven.mrgan</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgogICAgPHRpdGxlPlRlc3Q8L3RpdGxlPgogICAgPG1ldGEgaHR0cC1lcXVp
dj0iY29udGVudC10eXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmL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