Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 12 years ago

#1925 closed bug (fixed)

error with $(window).load in safari 2.0

Reported by: eric Owned by:
Priority: major Milestone: 1.2.2
Component: event Version: 1.2.1
Keywords: safari, event, window, load Cc:
Blocked by: Blocking:

Description

In Safari version 2.0 $(window).load fails with error 'undefined value'. For anyone testing this, Safari version 2.0.4 does _not_ have this bug, not sure about the other 2.0.x versions.

Attachments (1)

safari_window_load.patch (473 bytes) - added by eric 15 years ago.

Download all attachments as: .zip

Change History (5)

Changed 15 years ago by eric

Attachment: safari_window_load.patch added

comment:1 Changed 15 years ago by eric

As a test case, try:

$(window).load(function(){
    $('#output').append('<p>load</p>');
});

In Safari 2.0 event.target is null for window load events. Since other code in assumes there is an event.target, the code gives an undefined error. The patch modifies the fix function in event.js to provide the document object as a fallback for event.target, which conforms to what later versions of Safari do.

comment:2 Changed 15 years ago by brandon

Priority: criticalmajor

Fixed in Rev [3825]

comment:3 Changed 15 years ago by brandon

Resolution: fixed
Status: newclosed

comment:4 Changed 12 years ago by Rick Waldron

EDIT: Removing this patch will cause IE6,7,8 to crash

This bug no longer exists in jQuery supported versions of Safari. if there is any issues or unforseen regressions, the code used to correct this was:

 // Fix target property, if necessary
 if ( !event.target ) {
	// Fixes #1925 where srcElement might not be defined either
	event.target = event.srcElement || document;
}

in jQuery.event.fix()

This was discovered while implementing #8789

Last edited 12 years ago by Rick Waldron (previous) (diff)
Note: See TracTickets for help on using tickets.