Thank you for the test page.
Marco: yeah, display:none should be treated as if it doesn't exist in the document flow. But Safari treats it like it doesn't exist. :)
Prototype deals with this issue by temporarily showing the hidden element with visibility set to hidden and position to absolute.
That bug has been aroun for a while, btw.
Tobie: actually, the getStyle method in Prototype doesn't do that. I believe some of the stuff within Scriptaculous does.
The fact that we're talking 2.0, I think the fact the bug still exists is self evident that it has been around for awhile. Despite that, a search on the matter didn't really reveal any insight, which is why I wanted to document it here.
Jonathan, you are totally right...
Actually it is the getDimensions method which uses this technique.
But is should definitely be extended to getStyle in regards to what you mention.
I am sometimes surprised by the amount of bugs Safari has. We all spend our time bashing on IE, but if, for example, we cannot device a cross-browser rich text editor, it is not because of IE, but of Safari.
It is also because of Safari that we cannot have a cross browser way dealing with navigation history and back-button functionality when using Ajax.
Tobie: yeah... the problem with modifying the style of an object to use getStyle means that you could never use it to retrieve display or visibility values. Not a big deal, I'm sure but certainly a consideration.
Luis: I disagree, Safari was the first browser to pass the Acid2 test, and is in some aspects a better browser than firefox, I would rather have Microsoft change there standard browser to Firefox as it is still lagging behind greatly.
And remember what happened with IE when they had the biggest market share, they stopped innovating. Now there are still some points Firefox can learn from Opera and Safari and if these go away then it will be impossible to learn from the other browsers.
If some parent element has its display set to "none", than the mentioned fix still doesn't work...
safari (webkit) should and probably always will be bundled w/ apple software since webkit is intertwined into many of apple's applications nowadays. its even in itunes store for windows for petes sake.
plus webkit is so far the most css3 compliant browser around.
Hi. My name is Jonathan Snook and this is my site. I write about what interests me, which is usually web design, development, and technology. I'm also in the middle of a food adventure and I like whisky.
I wrote SMACSS. I tweet. Want to learn more?
© Jonathan Snook