Weird typeof issue in IE8 ( ie11 ) #1621
Comments
The IE8 issue is known for host objects, basically pre-es5 implementations played by their own rules, reporting that they were a function when they weren't or an object when they weren't. For dom elements you should use On the |
is what I ended up changing it to, since last i checked I don't know how much slower this makes the method in general or if it is worth putting it into underscore since it might be an isolated bug |
@jdalton Well, any old The problem is |
I can't reproduce this on my own tests. The amount of |
Yea I agree, it might not even be a problem in real IE8. |
Btw I work at Microsoft on Chakra (the JavaScript in IE9 and up). I'll ask around. I'm aware of Java applets causing some odd behavior on property access/types but not certain I've seen this. |
Nice. Yea, I gave u enough to show what kind of weird JS behavior where a string is not really a string or something... unless it's set to a variable then it behaves. |
Having a small repro would really help. If it is a JIT bug those can be hard to stumble upon. |
its a canvas element for one, I've taken the outerHTML to isolate the problem in a jsfiddle, but it is not reproducing using underscore, jquery and backbone. There is another issue where the scrollbar, while present, does not work. I can click the middle mouse wheel and scroll via that (not scroll but click), and then after after I'm done with that, I can scroll as normal, so that's definitely a browser bug ( chrome ), but nothing to do with this problem, it could be something related if for some reason some internal features are getting messed with. Why else would It could have something to do with any of these libraries.. it's something I've been putting off, hoping it'll resolve on it's own / I can hack a fix. I've got a lot of application code too, but I can't see putting that all on here and expecting you to dig through it, but maybe including some of these could reproduce or you might see one that looks suspect off the bat.
|
actually, it still happens with these libraries disabled
|
okay so it is happening on line 1105 of backbone 1.0.0 backbone is calling the view is being called like so
So.. its really weird..
i can console.log So, the el simultaneously exists and doesn't.. it can be pulled out but not seen on the parent. Anyway, I will look into this more on monday |
I just ran into this running Underscore's unit tests in IE11 under IE8 compat mode. Here is a small repro test case showing the issue. This looks like a JIT bug in IE11 when dealing with host objects in non-edge document modes. From the repro test case the console log output should be:
But instead the last log is:
The workaround is to simply add _.isFunction = function(obj) {
return typeof obj === 'function' || false;
}; Related to #605. |
@danschumann can you confirm if the workaround (manually modify your copy of Underscore) solves your issue too? |
The original issue is no longer occurring. Not sure if IE had a hotfixed or I changed some code elsewhere that was causing it. I didn't update underscore but something else seems to have fixed it. |
I confirmed on my own that the |
Is this still needed? |
Yap. |
So is the |
What's the aversion to opening pulls yourself? I follow the lodash repo but I really have no interest in constantly comparing implementations. |
Hi @jdalton , et. al! Has anyone had a chance to confirm this isn't an issue on "real" IE8? |
I've investigated, this only affects IE11 in non-edge compat modes. |
@jdalton Thanks for confirming, probably nice to have it in the underscore test suite. |
Related to lodash/lodash@0e88901. |
I'm having the issue with IE11 in IE8 mode as well. It looks like it only happens with non-minimized version of scripts. |
See my stackoverflow post here
http://stackoverflow.com/questions/23432494/ie8ie11-typeof-object-function-true-what
Basically,
String(typeof obj)
is needed, since(typeof obj === 'object' && typeof obj === 'function') // true
IE8 is weird. I think it does a weird optimization where typeof obj isn't a string unless you save it to a variable.
but ( parenthesis isn't enough to de-optimize)
you can also just wrap it in
String
obj
is defined from backbone. It isthis.el
. It is adom element
I know its not really broken ( ie8 is what's broken, and maybe only the ie11 version of ie8 at that )
The text was updated successfully, but these errors were encountered: