-
Notifications
You must be signed in to change notification settings - Fork 583
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
Map on Safari throws error when constructor is passed arguments #1650
Comments
We have a polyfill, so it is just a matter of changing the detection. |
+1 |
As a workaround I modified if (!global.Map) {
global.Map = Map;
} else {
try {
new global.Map([['k', 'v']]);
} catch (e) {
// Native Map doesn't support constructor arguments (Safari 8 and below).
global.Map = Map;
}
} |
+1 Angular 2.0 broken on Safari |
it works in WebKit Nightly though, or did last I checked =) Just be sure to use WK Nightly during your demos ;) |
I want to fix this... I just haven't had enough time to get it fixed.
Patches welcome. |
@zloirock I don't agree with that list. iterator closing is an abomination. I wish I had been stronger in opposing it at TC39. It requires all your code to be wrapped in a try/catch which is insane. |
@arv abomination, but required for compliance with the specification. Wrapper for constructor much better complete replacement of collection. |
@zloirock No doubt. We just have to prioritize things based on importance and this one is very low. |
@arv I've posted a workaround earlier, if you are too busy - I don't mind spending some time on a mature pull request. Only problem is I have no idea what is considered an acceptable PR for traceur. Could you point out a similar patch to use as scaffolding? Something small that's been accepted recently, addresses a similar feature, has tests, etc. BTW I'm not sure your test #3 will work though - Map constructor seems to throw an exception if any params are present. |
Yeah 3 needs a try/catch. This commit might be serve as inspiration: 1951203 Here is where the setup is done: https://github.com/google/traceur-compiler/blob/master/src/runtime/polyfills/Map.js#L195-L209 and similarly for Set. We might also need to have a way to detect if native Symbols are supported: https://github.com/google/traceur-compiler/blob/master/src/runtime/runtime.js#L462-L473 |
Safari does not support ES6 Map/Set correctly which leads to trouble. Be more strict in detecting whether the native Map/Set is good enough. Fixes google#1650, google#1810
Safari does not support ES6 Map/Set correctly which leads to trouble. Be more strict in detecting whether the native Map/Set is good enough. Fixes google#1650, google#1810
After compiling the following with Traceur (using es6ify):
Safari throws
I see from http://kangax.github.io/compat-table/es6/ that Safari does not support this feature of ES6. Are there any plans to polyfill it in Safari?
Traceur version: 0.0.79
Safari version: 8.0.2
The text was updated successfully, but these errors were encountered: