Skip to main content

Bug Tracker

Side navigation

#1925 closed bug (fixed)

Opened November 14, 2007 05:47AM UTC

Closed November 14, 2007 10:03PM UTC

Last modified September 22, 2011 01:55PM UTC

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)
Change History (4)

Changed November 14, 2007 06:13AM UTC by eric comment:1

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.

Changed November 14, 2007 09:56PM UTC by brandon comment:2

priority: criticalmajor

Fixed in Rev [3825]

Changed November 14, 2007 10:03PM UTC by brandon comment:3

resolution: → fixed
status: newclosed

Changed September 22, 2011 01:55PM UTC by rwaldron comment:4

_comment0: 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() \ 1316699838582865
_comment1: 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 \ 1316702302030086
_comment2: EDIT: Removing this patch will cause IE6,7,8 to crash \ \ <strike>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 \ </strike>1316703023812551

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