Skip to content

Commit

Permalink
Fix #13315 for IE9: compare typeof xmlNode.method to var instead of l…
Browse files Browse the repository at this point in the history
…iteral "undefined" for safer uglification

(cherry picked from commit ec9b38a)
  • Loading branch information
gibson042 committed Jan 27, 2013
1 parent 6f7b691 commit 64b55f0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/attributes.js
Expand Up @@ -134,7 +134,7 @@ jQuery.fn.extend({
} }


// Toggle whole class name // Toggle whole class name
} else if ( type === "undefined" || type === "boolean" ) { } else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) { if ( this.className ) {
// store className if set // store className if set
jQuery._data( this, "__className__", this.className ); jQuery._data( this, "__className__", this.className );
Expand Down Expand Up @@ -296,7 +296,7 @@ jQuery.extend({
} }


// Fallback to prop when attributes are not supported // Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) { if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value ); return jQuery.prop( elem, name, value );
} }


Expand Down Expand Up @@ -329,7 +329,7 @@ jQuery.extend({


// In IE9+, Flash objects don't have .getAttribute (#12945) // In IE9+, Flash objects don't have .getAttribute (#12945)
// Support: IE9+ // Support: IE9+
if ( typeof elem.getAttribute !== "undefined" ) { if ( typeof elem.getAttribute !== core_strundefined ) {
ret = elem.getAttribute( name ); ret = elem.getAttribute( name );
} }


Expand Down
4 changes: 4 additions & 0 deletions src/core.js
Expand Up @@ -5,6 +5,10 @@ var
// The deferred used on DOM ready // The deferred used on DOM ready
readyList, readyList,


// Support: IE9
// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
core_strundefined = typeof undefined,

// Use the correct document accordingly with window argument (sandbox) // Use the correct document accordingly with window argument (sandbox)
document = window.document, document = window.document,
location = window.location, location = window.location,
Expand Down
2 changes: 1 addition & 1 deletion src/event.js
Expand Up @@ -51,7 +51,7 @@ jQuery.event = {
eventHandle = elemData.handle = function( e ) { eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and // Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded // when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined; undefined;
}; };
Expand Down
1 change: 0 additions & 1 deletion src/manipulation.js
Expand Up @@ -563,7 +563,6 @@ function restoreScript( elem ) {


if ( match ) { if ( match ) {
elem.type = match[ 1 ]; elem.type = match[ 1 ];

} else { } else {
elem.removeAttribute("type"); elem.removeAttribute("type");
} }
Expand Down
2 changes: 1 addition & 1 deletion src/offset.js
Expand Up @@ -25,7 +25,7 @@ jQuery.fn.offset = function( options ) {


// If we don't have gBCR, just use 0,0 rather than error // If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone) // BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== "undefined" ) { if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect(); box = elem.getBoundingClientRect();
} }
win = getWindow( doc ); win = getWindow( doc );
Expand Down

0 comments on commit 64b55f0

Please sign in to comment.