Bug 13103 - REGRESSION (r15069): getPropertyValue() returns null when element has display: none (affects Technorati.com)
Summary: REGRESSION (r15069): getPropertyValue() returns null when element has display...
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: Macintosh PowerPC OS X 10.4
: P1 Normal
Assignee: Dave Hyatt
URL: http://technorati.com/
Keywords: HasReduction, InRadar, Regression
: 13193 13223 (view as bug list)
Depends on:
Reported: 2007-03-17 16:31 PDT by Stef Pause
Modified: 2007-03-29 01:58 PDT (History)
6 users (show)

See Also:

Reduction (645 bytes, text/html)
2007-03-18 22:20 PDT, Matt Lilek
no flags Details
Honor display property when we have no renderer. (892 bytes, patch)
2007-03-29 01:27 PDT, Dave Hyatt
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stef Pause 2007-03-17 16:31:24 PDT
Go to Technorati.com and click the "Sign In" link at the top-right.  This onclick JavaScript should cause the div id="signin" to change its style (via a slide effect) to "display: block;" which it does correctly in Safari v2.0.4, Firefox, Camino, etc.  However, in the latest Webkit nightly it slides down then immediately changes back to "display: none;".  This obviously makes it somewhat difficult to sign in ;)

The relevant JavaScript is:
onclick="if(document.all) $('select').hide();if($e('signin').style.display=='block') {$('#signin').slideUp('fast'); } else { $('#signin').slideDown('fast');$e('username').focus()};return false"

I'm not entirely sure if it's a Javascript bug or a DOM bug, I suspect the former, so I've filed it under "New Bugs".
Comment 1 Matt Lilek 2007-03-18 22:20:36 PDT
Created attachment 13701 [details]

The heart of this bug is that when an element has display: none, getPropertyValue() returns null instead of 'none' like Firefox/Opera.

This works in Safari 2.0.4 because jQuery (Technorati's JS framework of choice) checks if the getComputedStye() returns null, which Safari 2.0.4 does when an element has display: none.  In that case they then check if they're looking for the display property and return 'none'.

The reason this disappears in ToT after the animation is because we don't return 'none', jQuery's animation gizmo never gets sets the display as block permanently when it's finished, presuming we're handling that ourselves (ie: we want it to be display: inline) and removes the temporary display: block it added during animation.
Comment 2 Maciej Stachowiak 2007-03-19 11:51:34 PDT
Comment 3 mitz 2007-03-26 12:55:11 PDT
*** Bug 13193 has been marked as a duplicate of this bug. ***
Comment 4 mitz 2007-03-26 13:48:47 PDT
Regressed in <http://trac.webkit.org/projects/webkit/changeset/15069>. Safari 2 returns null from getComputedStyle() if the element doesn't have a renderer. r15069 and later return a CSSStyleDeclaration (which subsequently return null for all properties, see bug 12384).
Comment 5 Dave Hyatt 2007-03-29 01:27:07 PDT
Created attachment 13859 [details]
Honor display property when we have no renderer.
Comment 6 mitz 2007-03-29 01:27:46 PDT
*** Bug 13223 has been marked as a duplicate of this bug. ***
Comment 7 mitz 2007-03-29 01:40:34 PDT
Comment on attachment 13859 [details]
Honor display property when we have no renderer.

Needs a change log and a layout test. Also make sure that existing tests pass or are updated as needed. r=me
Comment 8 Dave Hyatt 2007-03-29 01:58:34 PDT
Fixed in r20570.