Bug Tracker

Opened 16 years ago

Closed 14 years ago

Last modified 11 years ago

#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)

safari-display-bug.html (1.7 KB) - added by remysharp 15 years ago.
Demo of Safari display prop bug. Result should say: 'none'

Download all attachments as: .zip

Change History (6)

comment:1 Changed 15 years ago by davidserduke

Owner: set to davidserduke
Status: newassigned

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.

comment:2 Changed 15 years ago by davidserduke

Owner: davidserduke deleted
Status: assignednew

comment:3 Changed 15 years ago by flesler

Milestone: 1.1.31.2.4

Could you retest this with jQuery 1.2.4 ?

comment:4 Changed 15 years ago by remysharp

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 remysharp

Attachment: safari-display-bug.html added

Demo of Safari display prop bug. Result should say: 'none'

comment:5 Changed 14 years ago by john

Milestone: 1.2.41.3
Priority: minormajor
Resolution: fixed
Status: newclosed
Version: 1.1.21.2.6

Fixed in SVN rev [5980].

Note: See TracTickets for help on using tickets.