Skip to content

Instantly share code, notes, and snippets.

@usmonster
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usmonster/9349332 to your computer and use it in GitHub Desktop.
Save usmonster/9349332 to your computer and use it in GitHub Desktop.
bug in aight's shim for Element.prototype.textContent
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script type="text/javascript">
function test() {
try {
var e = document.createElement('div');
e.innerHTML = '&nbsp;';
var n = e.childNodes[0];
n.ownerDocument;
e.textContent = '';
n.ownerDocument;
alert('worked!');
} catch (ex) {
alert('NOPENOPENOPE');
}
}
</script>
<script type="text/javascript">test();</script>
<!--[if lt IE 9]>
<script type="text/javascript" src="http://rawgithub.com/shawnbot/aight/master/js/element-properties.js"></script>
<script type="text/javascript">test();</script>
<![endif]-->
</head>
<body>
</body>
</html>
@usmonster
Copy link
Author

Traced it to element-properties.js. (issue).

Can be seen manifesting in the wild (e.g., when shim is used with popular libraries such as jQuery >= 1.9, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment