-
Notifications
You must be signed in to change notification settings - Fork 5.7k
PhantomJS doesn't iterate over the arguments object #11558
Comments
FWIW the following "passes" var success = false;
(function f() {
var args = Array.prototype.slice.call(arguments);
for (var i in args) {
success = true;
}
})(1);
console.log(success ? "Test passed!" : "Test failed!"); |
Yap, this is just a bug in JavaScriptCore. I've worked around this in Lo-Dash, |
@jdalton The problem is when you have such iteration in a library code. Since this is not polyfillable, the only way to make it work in PhantomJS is to patch vendor libraries which I try to avoid; every such a fork is a maintenance burden. |
PhantomJS is based on WebKit/JSC and has bugs that can be found in equiv Safari browsers (desktop & mobile). If your library code doesn't work then you may want to extend support, as I did with Lodash. It's not insurmountable. If you don't want to support Safari ~5 then just be aware of its limitations/gotchas when you construct your test cases & usage scenarios for PhantomJS is all. |
@jdalton That's the thing, I generally don't need to support Safari ~5 and some libs I use don't target it as well. jQuery 2.1/1.11 will even drop Safari 5.1, not mentioning 5.0. This means that if you don't target old Safari and use libraries that don't do it either, you often can't do tests in PhantomJS. And it will only get worse over time. |
Yes, not supporting an environment will make it harder to test in. |
Fixed in Qt5-based master branch. |
With the following
test.js
file:PhantomJS logs:
$ phantomjs test.js Test failed!
The text was updated successfully, but these errors were encountered: