[Webkit-unassigned] [Bug 15562] getComputedStyle returns "auto" for zIndex property even after it has been set

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 18 08:12:31 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=15562


Michael Yagudaev <michaelyagudaev at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michaelyagudaev at gmail.com




--- Comment #13 from Michael Yagudaev <michaelyagudaev at gmail.com>  2011-08-18 08:12:30 PST ---
Ok I believe I figured out the reason for this bug. 

If you read the css3 specification for z-index (http://www.w3.org/TR/CSS2/visuren.html#z-index) it says that the default value for a z-index is auto. Now, if an element is not applied with a position type that is non-static (i.e. position is relative, absolute or fixed), static is default for position so the z-index will have no effect on the element. So it seems webkit does not bother calculating this z-index and just returns the default, which is auto.

The work around to fix this therefore is
[selector]
{
   position: relative;
}

If you want to get the value of the container then use:
[selector]
{
   position: relative;
   z-index: inherit;
}

The above is really useful when implementing loading spinners for your content (e.g. a spinner that appears on top of a dialog, simply get the z-index and increment by one).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list