| <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=25381">bug 25381</a>: |
| jQuery animation crashing Safari.</p> |
| <p>PASS if didn't crash.</p> |
| <div style="position:fixed; top:0px; width:100px; background:red;"> |
| <div id="i" style="position:fixed; display:none; top:0px; width:100px; height:100px; overflow:hidden; background:green;"><div>ABC</div></div> |
| </div> |
| |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| function swap( elem, options, callback ) { |
| var old = {}; |
| // Remember the old values, and insert the new ones |
| for ( var name in options ) { |
| old[ name ] = elem.style[ name ]; |
| elem.style[ name ] = options[ name ]; |
| } |
| |
| callback.call( elem ); |
| |
| // Revert the old values |
| for ( var name in options ) { |
| elem.style[ name ] = old[ name ]; |
| } |
| } |
| |
| function forceLayout() |
| { |
| document.body.offsetTop; |
| } |
| |
| setTimeout(function() { |
| var elem = document.getElementById('i'); |
| elem.style['display']='block'; |
| |
| var val, props = { position: "absolute", visibility: "hidden", display:"block" }; |
| function getWH() { |
| val = elem.offsetHeight; |
| } |
| swap( elem, props, getWH ); |
| |
| forceLayout(); |
| elem.style['height']=2; |
| forceLayout(); |
| elem.style['height']=3; |
| forceLayout(); |
| elem.style['display']='none'; |
| forceLayout(); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| return; |
| }, 0); |
| |
| </script> |
| |