-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support differences of spread operator with spec #38
Comments
This problem is on specification side. In current version of spec spread operation is only allowed on Array or on objects with Iterator protocol implementation. It doesn't allow on array-like objects like {0: 'first', length: 1} btw, the current version of traceur does not support this: http://google.github.io/traceur-compiler/demo/repl.html#debugger%3B%0A%0Avar%20a%20%3D%20%5B...document.querySelectorAll('div')%5D Update: i am sorry this link is invalid, I can't find a valid link right now |
The easiest way for you is to implement Iterator Protocol on NodeList. Something like this: var $Symbol_iterator=typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';
NodeList[$Symbol] = function() {
return {
next: function() {//do it
}
}
} |
Ah. That worked in a previous version of traceur. Using the following syntax works in Firefox Nightly 33, but not in es6-transpiler or traceur.
|
Also, is the |
@iamdustan The goal of es6-transpiler is to support Symbol.iterator. The '@@iterator' is just a fallback |
This bit of code works perfectly fine with Traceur.
With the es6-transpiler the output is:
and the following error is thrown:
Is this expected and part of the not-yet-supported iterator-able pieces?
The text was updated successfully, but these errors were encountered: