Side navigation
#1239 closed bug (fixed)
Opened May 23, 2007 03:49PM UTC
Closed December 19, 2008 06:21PM UTC
Last modified March 15, 2012 01:06AM UTC
hide function broken in Safari on elements not in DOM (see example)
Reported by: | remysharp | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | effects | Version: | 1.2.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
var p = $('<p>test</p>').hide(); alert(p[0].style.display);
In Firefox, correctly displays 'none', in Safari this is blank. The effect is when preparing a new element to fade in to the page the fade doesn't work in Safari (because it's already fully visible).
Tested with jQuery 1.1.3a, Firefox 2 and Safari 2 on OS 10.4 and IE7.
Work around:
var p = $('<p>test</p>').css('display', 'none'); alert(p[0].style.display);
Attachments (1)
Change History (5)
Changed November 17, 2007 03:01AM UTC by comment:1
owner: | → davidserduke |
---|---|
status: | new → assigned |
Changed November 17, 2007 04:50AM UTC by comment:2
owner: | davidserduke |
---|---|
status: | assigned → new |
Changed May 16, 2008 07:57PM UTC by comment:3
milestone: | 1.1.3 → 1.2.4 |
---|
Could you retest this with jQuery 1.2.4 ?
Changed May 17, 2008 12:03AM UTC by comment:4
Test failed. I've attached a test to this ticket, but also uploaded it here:
http://remysharp.com/demo/safari-display-bug.html
I did propose a fix for it a little while ago, but the change was deep inside the core jQuery library and I wasn't confident enough to make the change without a second opinion:
http://groups.google.com/group/jquery-dev/browse_thread/thread/9695ea22968d98b3/ef45b65f3ceb2e81
Changed December 19, 2008 06:21PM UTC by comment:5
milestone: | 1.2.4 → 1.3 |
---|---|
priority: | minor → major |
resolution: | → fixed |
status: | new → closed |
version: | 1.1.2 → 1.2.6 |
Fixed in SVN rev [5980].
This problem here is that jQuery reports the newly created element as :hidden so when hide() is called it essentially just returns. There is quite a bit of code in curCSS() (which :hidden uses) that is special cased to Safari in an attempt to handle how it returns its current CSS, but apparently this is one case where it fails.
There is an easy work around for this bug as stated above. I'm going to leave it open for now but personally I think the risks at this point of fixing this minor bug outweigh the gain of fixing it.