Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($injector): workaround for MS Edge class detection #13697

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

@lgalfaso lgalfaso commented Jan 6, 2016

Fix for MS Edge class detection

@lgalfaso
Copy link
Contributor Author

lgalfaso commented Jan 6, 2016

@petebacondarwin can you take a look at this? Did some small so we do not have to keep track of what browser supports what ES6 feature

@lgalfaso lgalfaso force-pushed the edge-class branch 3 times, most recently from 7652275 to 221b3be Compare January 6, 2016 22:26

if (support.classes) {
it('should be possible to instantiate ES6 classes', function() {
// Only Chrome (not even the FF we use) supports ES6 classes.
if (!/chrome/i.test(navigator.userAgent)) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgalfaso should this chrome check be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right

@petebacondarwin
Copy link
Contributor

One question, otherwise LGTM

@petebacondarwin petebacondarwin added this to the 1.5.0-rc.1 milestone Jan 7, 2016
return typeof func === 'function'
&& /^class\s/.test(Function.prototype.toString.call(func));
&& /^(?:class\s|constructor\()/.test(Function.prototype.toString.call(func));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think we need to test for constructor( only if we are on Edge, since it is possible that someone might have a function actually called constructor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgalfaso explained that:

(function constructor() {}).toString() === "function constructor() {}"

So this is not an issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants