adding event handler to the <html> element in IE<9 will crash jquery 1.5.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* probably not good practice to attach event handlers to the <html> element but... | |
*/ | |
//IE < 9 throws operation not supported error just on property existence check (not function invocation) | |
typeof $('html')[0]; //"unknown" | |
$('html')[0].removeAttribute //throws operation not supported error | |
/************************************************/ | |
//jquery 1.5.2 lines 1503-1516 | |
// Otherwise, we need to eliminate the expando on the node to avoid | |
// false lookups in the cache for entries that no longer exist | |
} else if ( isNode ) { | |
// 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 ( jQuery.support.deleteExpando ) { | |
delete elem[ jQuery.expando ]; | |
} else if ( elem.removeAttribute ) { // <------------ blows up here | |
elem.removeAttribute( jQuery.expando ); | |
} else { | |
elem[ jQuery.expando ] = null; | |
} | |
} |
Problems like this:
// try in IE
var div = document.createElement('div');
typeof div.offsetParent // unknown
div.offsetParent // boom!
have been address with something like an isHostType method.
Yeah I can only reproduce it sporadically too. Need to do more digging. Thanks for the test case.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can't seem to reproduce this. I created a small test case here.