Raynos / DOM-shim

Shims out the entire DOM4 API
http://raynos.github.com/DOM-shim/test/test.html
155 stars 15 forks source link

IE8: This object doesn't support this property or method on line 23 #46

Closed ralt closed 12 years ago

ralt commented 12 years ago

Just including the following in my HTML like this:

<!-- [if IE 8]>
<script src="https://raw.github.com/Raynos/DOM-shim/master/lib/DOM-shim-ie8.js"></script>
<![endif] -->
<script src="https://raw.github.com/Raynos/DOM-shim/master/lib/DOM-shim.js"></script>

Gives the following error in IE8:

This object doesn't support this property or method

IE tells me the error is on line 23:

domains.forEach(function(e){

Is forEach supported in IE8? Adding ES5-shim doesn't help since it doesn't support IE8 (well, it throws an exception, so the shim doesn't work).

termi commented 12 years ago
<html>

<head>
<!-- [if IE 8]>
<script src="https://raw.github.com/Raynos/DOM-shim/master/lib/DOM-shim-ie8.js"></script>
<![endif] -->
<script src="https://raw.github.com/Raynos/DOM-shim/master/lib/DOM-shim.js"></script>
<script src="https://raw.github.com/kriskowal/es5-shim/master/es5-shim.js"></script>
</head>

<body>

<p id=test>test</p>
<script>
var domains = ["test"];
domains.forEach(function(e){
    alert(document.querySelector("#" + e).innerHTML)
});
</script>

Works even in IE7. WAIDW?

ralt commented 12 years ago

Well, I guess this is on my environment then.

Debugging in IE, I've found that [].forEach() returns the same error message right before the domains.forEach line.

If I put the ES5-shim script after the DOM-shim, using [].forEach() works correctly after the page has completely loaded.

If I put the ES5-shim script before the DOM-shim, I get the following error on line 23:

Exception thrown and not caught

However, using [].forEach() works once the page is loaded.

I don't get what is wrong, and I don't know how I should debug this.

Raynos commented 12 years ago

I don't get it either :D

ralt commented 12 years ago

Here is a jsfiddle: http://jsfiddle.net/YhG7H/

This jsfiddle, with IE8, shows the behavior explained up there (error at line 23, etc).

I have IE8.0.6001.18702.

Raynos commented 12 years ago

change the order of es5 shim and dom shim and problem solved

ralt commented 12 years ago

No, it doesn't solve the problem. But I don't have time to mess around with this for now, I'll reopen when I'll have more information.