]> source.dussan.org Git - jquery.git/commitdiff
Fix #13315: compare typeof node.method to var instead of literal "undefined" for...
authorRichard Gibson <richard.gibson@gmail.com>
Thu, 24 Jan 2013 04:25:29 +0000 (23:25 -0500)
committerRichard Gibson <richard.gibson@gmail.com>
Thu, 24 Jan 2013 05:13:16 +0000 (00:13 -0500)
src/attributes.js
src/core.js
src/event.js
src/manipulation.js
src/offset.js
src/support.js

index 754a35e87916655eee79f8472c6cb53ddcea2cc3..5aaadb7c4f8bd9ce919365f1622b8642e978edf1 100644 (file)
@@ -137,7 +137,7 @@ jQuery.fn.extend({
                                }
 
                        // Toggle whole class name
-                       } else if ( type === "undefined" || type === "boolean" ) {
+                       } else if ( type === core_strundefined || type === "boolean" ) {
                                if ( this.className ) {
                                        // store className if set
                                        jQuery._data( this, "__className__", this.className );
@@ -299,7 +299,7 @@ jQuery.extend({
                }
 
                // 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 );
                }
 
@@ -332,7 +332,7 @@ jQuery.extend({
 
                        // In IE9+, Flash objects don't have .getAttribute (#12945)
                        // Support: IE9+
-                       if ( typeof elem.getAttribute !== "undefined" ) {
+                       if ( typeof elem.getAttribute !== core_strundefined ) {
                                ret =  elem.getAttribute( name );
                        }
 
index 86516775781b869c506eaeb0a2e7834c9765dab7..64c9f9cc7545c35f19c9ef7dffaec3defc91bb91 100644 (file)
@@ -5,6 +5,10 @@ var
        // The deferred used on DOM ready
        readyList,
 
+       // Support: IE<9
+       // For `typeof node.method` instead of `node.method !== undefined`
+       core_strundefined = typeof undefined,
+
        // Use the correct document accordingly with window argument (sandbox)
        document = window.document,
        location = window.location,
index 5841aff7ca64baf028c16ade040689f0e6c4aa54..ca8719b7f4293bc4f239f39f5d69efe0ebac2341 100644 (file)
@@ -52,7 +52,7 @@ jQuery.event = {
                        eventHandle = elemData.handle = function( e ) {
                                // Discard the second event of a jQuery.event.trigger() and
                                // 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 ) :
                                        undefined;
                        };
@@ -619,7 +619,7 @@ jQuery.removeEvent = document.removeEventListener ?
 
                        // #8545, #7054, preventing memory leaks for custom events in IE6-8
                        // detachEvent needed property on element, by name of that event, to properly expose it to GC
-                       if ( typeof elem[ name ] === "undefined" ) {
+                       if ( typeof elem[ name ] === core_strundefined ) {
                                elem[ name ] = null;
                        }
 
index 34309d0c94f01adfc211ab6298f89dd589be0d8a..569a71d8320ecf477dda4f4ee61b13791492380d 100644 (file)
@@ -531,8 +531,8 @@ jQuery.each({
 function getAll( context, tag ) {
        var elems, elem,
                i = 0,
-               found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) :
-                       typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) :
+               found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
+                       typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
                        undefined;
 
        if ( !found ) {
@@ -778,7 +778,7 @@ jQuery.extend({
                                                if ( deleteExpando ) {
                                                        delete elem[ internalKey ];
 
-                                               } else if ( typeof elem.removeAttribute !== "undefined" ) {
+                                               } else if ( typeof elem.removeAttribute !== core_strundefined ) {
                                                        elem.removeAttribute( internalKey );
 
                                                } else {
index 04c94cadee0600f080b334de62c5059ad60f3af1..4efb962ff2abf95de509ceaf71685316ed0c86bf 100644 (file)
@@ -25,7 +25,7 @@ jQuery.fn.offset = function( options ) {
 
        // If we don't have gBCR, just use 0,0 rather than error
        // BlackBerry 5, iOS 3 (original iPhone)
-       if ( typeof elem.getBoundingClientRect !== "undefined" ) {
+       if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
                box = elem.getBoundingClientRect();
        }
        win = getWindow( doc );
index ce764a1ce088bfe3bb02181e1952061671938d94..09f894c70072730ae66ea2485f19db666231fed4 100644 (file)
@@ -201,7 +201,7 @@ jQuery.support = (function() {
                                !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
                }
 
-               if ( typeof div.style.zoom !== "undefined" ) {
+               if ( typeof div.style.zoom !== core_strundefined ) {
                        // Support: IE<8
                        // Check if natively block-level elements act like inline-block
                        // elements when setting their display to 'inline' and giving