#1239 closed bug (fixed)
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 (6)
comment:1 Changed 15 years ago by
Owner: | set to davidserduke |
---|---|
Status: | new → assigned |
comment:2 Changed 15 years ago by
Owner: | davidserduke deleted |
---|---|
Status: | assigned → new |
comment:3 Changed 15 years ago by
Milestone: | 1.1.3 → 1.2.4 |
---|
Could you retest this with jQuery 1.2.4 ?
comment:4 Changed 15 years ago by
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 15 years ago by
Attachment: | safari-display-bug.html added |
---|
Demo of Safari display prop bug. Result should say: 'none'
comment:5 Changed 14 years ago by
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.