aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2013-01-23 23:25:29 -0500
committerRichard Gibson <richard.gibson@gmail.com>2013-01-27 10:04:09 -0500
commit64b55f0b7912d96c3bdae8c771b4da99c96954fd (patch)
tree09ada1566e7122e16438ad82f7807ec1a340a016
parent6f7b6915bf457c413476faefb2159df717c2c210 (diff)
downloadjquery-64b55f0b7912d96c3bdae8c771b4da99c96954fd.tar.gz
jquery-64b55f0b7912d96c3bdae8c771b4da99c96954fd.zip
Fix #13315 for IE9: compare typeof xmlNode.method to var instead of literal "undefined" for safer uglification
(cherry picked from commit ec9b38a34fb9bd81d1903cf12b69466f699abca5)
-rw-r--r--src/attributes.js6
-rw-r--r--src/core.js4
-rw-r--r--src/event.js2
-rw-r--r--src/manipulation.js1
-rw-r--r--src/offset.js2
5 files changed, 9 insertions, 6 deletions
diff --git a/src/attributes.js b/src/attributes.js
index fd40f0018..c9e7dbc47 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -134,7 +134,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 );
@@ -296,7 +296,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 );
}
@@ -329,7 +329,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 );
}
diff --git a/src/core.js b/src/core.js
index 9efdc229e..c2dc4bc9b 100644
--- a/src/core.js
+++ b/src/core.js
@@ -5,6 +5,10 @@ var
// The deferred used on DOM ready
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)
document = window.document,
location = window.location,
diff --git a/src/event.js b/src/event.js
index 7cb141a63..54e08c8e7 100644
--- a/src/event.js
+++ b/src/event.js
@@ -51,7 +51,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;
};
diff --git a/src/manipulation.js b/src/manipulation.js
index 9b70db7f3..708d7851d 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -563,7 +563,6 @@ function restoreScript( elem ) {
if ( match ) {
elem.type = match[ 1 ];
-
} else {
elem.removeAttribute("type");
}
diff --git a/src/offset.js b/src/offset.js
index 4fb37bb7c..fc110f012 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -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 );