Bug Tracker

Modify

Ticket #1239 (closed bug: fixed)

Opened 6 years ago

Last modified 15 months ago

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:
Blocking: Blocked by:

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

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

Change History

comment:1 Changed 6 years ago by davidserduke

  • Owner set to davidserduke
  • Status changed from new to assigned

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 6 years ago by davidserduke

  • Owner davidserduke deleted
  • Status changed from assigned to new

comment:3 Changed 5 years ago by flesler

  • Milestone changed from 1.1.3 to 1.2.4

Could you retest this with jQuery 1.2.4 ?

comment:4 Changed 5 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 5 years ago by remysharp

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

comment:5 Changed 4 years ago by john

  • Priority changed from minor to major
  • Status changed from new to closed
  • Version changed from 1.1.2 to 1.2.6
  • Resolution set to fixed
  • Milestone changed from 1.2.4 to 1.3

Fixed in SVN rev [5980].

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.