es-shims/es5-shim

Many tests broken in ie8

Closed this issue · 19 comments

Using real ie8 (i.e. not ie9's "act as ie8" mode), 57 of the 156 tests are currently failing for me in ie8. Many of these issues are not mentioned under the "dubious shims" section in the README (e.g. tests for filter, indexOf fail).

Using ie9's emulate ie8 mode, I get 3 failures, all for Object.isExtensible.

Thanks. Any help with this would be appreciated.

The 56 tests in question fail on my IE 8 VM as well. Investigating now...

Yeah, beginning to look further into this, and it seems like many, perhaps almost all, of these issues are related to the way IE8 (I suspect IE7 as well, but don't know for sure) handles for ... in and also obj.hasOwnProperty. A workaround is not immediately obvious to me.

It might be useful to do the full Object.prototype.hasOwnProperty.call(object, key) incantation somewhere to isolate the issue.

Tried that, to no avail.

It may be worth noting that the lone underscore.js test that fails for me in ie8 is related to precisely this same issue.

@lukeasrodgers What's the failing Underscore test?

_.uniq, which fails on the test where undefined is an element of an array.

Sounds like it's a sparse array bug...IE <= 8 treats undefined array elements as elisions. That's why the es5-shim Array#indexOf(undefined) test fails—the undefined element does't exist.

The test array is [2, 3, undefined, true, 'hej', null, 2, false, 0], but IE sees it as [2, 3, , true, 'hej', null, 2, false, 0]. [2, 3, , true, 'hej', null, 2, false, 0].indexOf(undefined) == -1.

Any progress on this issue? I can invest a little time to see if I can fix the these ... but don't want to spend time if someone is doing this.

No one is presently researching the issue. We can’t fix the IE<=8 elision bug, but we can rewrite the test to not have undefined. If you’ve got the time, I’ve got the trigger finger on the merge button.

Hi Kris,

I've got some time...but not sure I have the full understanding of the underlying issues. Is there any documentation you suggest I read to get up to speed? I will google around for the "IE<=8 elision bug." What do you want/need me to do for this "rewrite the test to not have undefined"?

Doug

On Oct 9, 2012, at 10:27 PM, Kris Kowal wrote:

No one is presently researching the issue. We can’t fix the IE<=8 elision bug, but we can rewrite the test to not have undefined. If you’ve got the time, I’ve got the trigger finger on the merge button.


Reply to this email directly or view it on GitHub.

I haven't investigated this issue, but it sounds like a manifestation of the infamous IE DontEnum Bug. There are viable workarounds floating around the internet if you google it. Hope this helps!

It is the DontEnum bug. IE’s don’t recognize the difference between array holes and explicitly enumerable but undefined properties. This makes it difficult, possibly unreasonable, or simply impossible for ES5-Shim to emulate Array methods that respect holes. So, it’s a tricky situation. We could separate the specs that we don’t expect to work in older IE’s. I would prefer not to drop them entirely, since we do implement them properly for older FF’s and Safari’s. But, it also becomes a question of whether it is ES5-Shim’s job to level the playing field to the lowest common denominator, as we did when separating ES5-Sham.

For ie8 there is no native support for html 5 functions such as. .. forEach, filter, indexOf, bind, search etc. So you need to define these methods ss prototype functions, like .forEach as Array.prototype.forEach , then define the function for the same. . Regsrds, Waseem Vellore

Yes; that's exactly what this entire project does (and those have nothing to do with HTML5).

This problem is more complicated

57 test are still failing. Only the 3 failing tests for Object.isExtensible in es5-sham seem to be fixable - the other 54 seem related to the intractable JScript 5 bug treating undefined values and array holes as the same (#190, #131) for which there seems to be no solution.

I hit this today:

var properties = {
    constructor: {}
};
for (var name in properties) {
    console.log(name); // <-- constructor is never iterated even though it is user defined
}

Specifically Object.create and Object.defineProperties will not pickup the user defined constructor property. Although this doesn't seem to work in most shims I've tried. Works in core-js though.

Object.create and Object.defineProperties aren't in the shim, only the sham - quirks with them are to be expected.

I've added a feature detection to the array tests to determine when it's in an engine that can't distinguish between an absent item, and a present undefined - namely, IE 6-8.

This leaves only 3 Array tests failing in IE 8 (filed as #341), and all Array tests passing in IE 6 and 7.

Any remaining failures in IE 6-8 are real, and either already have issues filed, or, need issues to be filed.