Skip to content
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

Provide/Inject fails with polyfilled Symbol #7284

Closed
privatenumber opened this issue Dec 19, 2017 · 3 comments · Fixed by #7460
Closed

Provide/Inject fails with polyfilled Symbol #7284

privatenumber opened this issue Dec 19, 2017 · 3 comments · Fixed by #7460

Comments

@privatenumber
Copy link
Contributor

Version

2.5.12

Reproduction link

https://jsfiddle.net/hirokiosame/dronjdzm/16/

Steps to reproduce

Run code in IE11.

Either remove the <wrapper> from the Parent component on L25 or change the Symbol into a String on L9 and it will work fine.

What is expected?

For it to print "Message from parent: Hello World from Parent"

What is actually happening?

Doesn't receive the injection.
screen shot 2017-12-20 at 2 49 51 am

@yyx990803
Copy link
Member

Symbol isn't even supported in IE11. Are you using a polyfill?

@privatenumber
Copy link
Contributor Author

privatenumber commented Dec 19, 2017

@yyx990803
Yeah, checkout the External Resources section; it's using babel-polyfill 6.26.0

@yyx990803 yyx990803 changed the title Provide/Inject fails with Symbol in IE11 Provide/Inject fails with polyfilled Symbol Dec 19, 2017
@privatenumber
Copy link
Contributor Author

privatenumber commented Dec 19, 2017

I'm hesitant to say that it's an issue with the Symbol polyfill specifically since it works when I change the <wrapper> in the Parent component on L25 to a <div>.

I've found that the bug is only reproducible:

  1. when the symbol is converted into a string
  2. when the Parent is not using a wrapper component that is also providing arbitrary data.

privatenumber pushed a commit to privatenumber/vue that referenced this issue Jan 16, 2018
Symbol polyfill adds a setter on the Object prototype so the 'in' check evaluated to true on every
object

fix vuejs#7284
privatenumber pushed a commit to privatenumber/vue that referenced this issue Jan 16, 2018
Prototype properties were being injected, so injecting 'constructor' would have hit the first
provide-layer and not yield expected results.

fix vuejs#7284
yyx990803 pushed a commit that referenced this issue Mar 8, 2018
fix #7284

* fix(Injection with Symbol polyfill): hasOwn instead of 'in'

Symbol polyfill adds a setter on the Object prototype so the 'in' check evaluated to true on every
object

* test(Injected properties): Ensures prototype properties aren't injected

Prototype properties were being injected, so injecting 'constructor' would have hit the first
provide-layer and not yield expected results.
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
)

fix vuejs#7284

* fix(Injection with Symbol polyfill): hasOwn instead of 'in'

Symbol polyfill adds a setter on the Object prototype so the 'in' check evaluated to true on every
object

* test(Injected properties): Ensures prototype properties aren't injected

Prototype properties were being injected, so injecting 'constructor' would have hit the first
provide-layer and not yield expected results.
aJean pushed a commit to aJean/vue that referenced this issue Aug 19, 2020
)

fix vuejs#7284

* fix(Injection with Symbol polyfill): hasOwn instead of 'in'

Symbol polyfill adds a setter on the Object prototype so the 'in' check evaluated to true on every
object

* test(Injected properties): Ensures prototype properties aren't injected

Prototype properties were being injected, so injecting 'constructor' would have hit the first
provide-layer and not yield expected results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants