This repository has been archived by the owner on May 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Array.from() with NodeList causes TypeError #14216
Comments
ES6 features are not supported in PhantomJS yet. |
@vitallium Thank you for your answer! This is quite funny, because as I already said, this is a part of a Babel generated code. var arr = [...theNodeList]; to convert a function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var arr = _toConsumableArray(theNodeList); I have taken this way of conversion from the docs. So, as you already mentioned that |
Can be tracked here https://phabricator.babeljs.io/T7305 |
In the mean time, please track ES6 support in #14506. Thank you! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
1. Which version of PhantomJS are you using?
2.1.5
2. What steps will reproduce the problem?
In a Babel generated code I have something like that:
document.querySelectorAll("*")
returns aNodeList
. PhantomJS will fail with this code.TypeError: undefined is not a constructor (evaluating 'Array.from(document.querySelectorAll("*"))')
3. Which operating system are you using?
Windows 7
4. Did you use binary PhantomJS or did you compile it from source?
I am using Karma, which acutally needs phantomjs-prebuilt. So I am not using phantomjs directly.
The text was updated successfully, but these errors were encountered: