/* jshint eqeqeq: true */
delete cache[ id ];
- // When all else fails, null
+ // When all else fails, undefined
} else {
- cache[ id ] = null;
+ cache[ id ] = undefined;
}
}
(function() {
var div = document.createElement( "div" );
- // Execute the test only if not already executed in another module.
- if (support.deleteExpando == null) {
- // Support: IE<9
- support.deleteExpando = true;
- try {
- delete div.test;
- } catch ( e ) {
- support.deleteExpando = false;
- }
+ // Support: IE<9
+ support.deleteExpando = true;
+ try {
+ delete div.test;
+ } catch ( e ) {
+ support.deleteExpando = false;
}
// Null elements to avoid leaks in IE.
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
- deleteExpando = support.deleteExpando,
+ attributes = support.attributes,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
delete cache[ id ];
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( deleteExpando ) {
- delete elem[ internalKey ];
-
- } else if ( typeof elem.removeAttribute !== "undefined" ) {
+ // Support: IE<9
+ // IE does not allow us to delete expando properties from nodes
+ // IE creates expando attributes along with the property
+ // IE does not have a removeAttribute function on Document nodes
+ if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
elem.removeAttribute( internalKey );
+ // Webkit & Blink performance suffers when deleting properties
+ // from DOM nodes, so set to undefined instead
+ // https://code.google.com/p/chromium/issues/detail?id=378607
} else {
- elem[ internalKey ] = null;
+ elem[ internalKey ] = undefined;
}
deletedIds.push( id );
define([
+ "../core",
"../var/support"
-], function( support ) {
+], function( jQuery, support ) {
(function() {
var div = document.createElement( "div" ),
// Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
support.noCloneEvent = !!div.addEventListener;
- // Execute the test only if not already executed in another module.
- if (support.deleteExpando == null) {
- // Support: IE<9
- support.deleteExpando = true;
- try {
- delete div.test;
- } catch ( e ) {
- support.deleteExpando = false;
- }
- }
+ // Support: IE<9
+ // Since attributes and properties are the same in IE,
+ // cleanData must set properties to undefined rather than use removeAttribute
+ div[ jQuery.expando ] = 1;
+ support.attributes = !div.getAttribute( jQuery.expando );
})();
return support;
});
test("Expando cleanup", 4, function() {
- var expected, actual,
- div = document.createElement("div");
+ var div = document.createElement("div");
function assertExpandoAbsent(message) {
- if (jQuery.support.deleteExpando) {
- expected = false;
- actual = jQuery.expando in div;
- } else {
- expected = null;
- actual = div[ jQuery.expando ];
- }
- equal( actual, expected, message );
+ strictEqual( div[ jQuery.expando ], undefined, message );
}
assertExpandoAbsent("There is no expando on new elements");
// Android browser on Android >= 4.4).
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": false,
"changeBubbles": true,
"checkClone": true,
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": false,
"changeBubbles": true,
"checkClone": true,
} else if ( /msie 8\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": false,
"boxSizingReliable": false,
"changeBubbles": false,
"checkClone": true,
} else if ( /(6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
} else if ( /8.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
} else if ( /iphone os/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": false,
} else if ( /android 2\.3/i.test( userAgent ) ) {
expected = {
"ajax": true,
+ "attributes": true,
"boxSizingReliable": true,
"changeBubbles": true,
"checkClone": true,