4 ms·
The app I needed to convert needed several JS hacks to get IE9 working. For example Number("") evaluates to NaN in IE9 while it evaluates to 0 in every other br
by speleding 16y ago
The app I needed to convert needed several JS hacks to get IE9 working. For example Number("") evaluates to NaN in IE9 while it evaluates to 0 in every other browser. It's small things like that which cause hard to find bugs.
- GrandMasterBirt 16y agoJasmine tests to the rescue :) They need to implement strict js mode in IE9. That mode really set some good rules on some weird js behaviors.
- SoftwareMaven 16y agoIE9 actually gets this one correct according to the language spec, but I assume it was a bad assumption that made it incorrect. The Number constructor is supposed to call ToNumber on its parameter, which is supposed to return NaN if it can't parse StringNumericLiterals, which would be the case with "". I think the confusion came from "" being treated as "false" in JavaScript, and Number is supposed to return 0 if it isn't given a parameter. I could imagine the code in the Number constructor looking like this for non-IE browsers: if (param) num = ToNumber(param) else num = 0 whereas in IE, it probably looks more like this: if (param != undefined) num = ToInteger(param) else num = 0