-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
onclick={{action 'myAction'}} doesn't work on svg elements #13420
Comments
onclick={{action 'myAction'}}
doesn't work on svg elements
When in the svg namespace we always set attribute (not properties). When you set an attribute to a function, it will set the attribute to the string value of the function instead. |
@andressrg It sounds like we need more documentation on SVG use in component, especially regarding actions. I didn't know that when using SVG the attribute will become the string value. So It sounds like you may need a workaround. How about using browser events instread? @locks is there documenation available or in the works regarding using SVG elements in Ember components? |
@rwjblue I think if |
@krisselden - I was not justifying that the current behavior was correct, I was explaining what is happening. |
This would also be addressed by attr-first-but-special-behavior-when-type-of-function in Glimmer |
Any word on what the fix might be? |
UP, same error with Glimmerjs |
Just seen this in Glimmer as well - if anyone has a work around then that would be great. |
@lllama, @tonyhschu this works for me: <polygon points="300,1007.5 300,1550 0,775 300,0 300,542.5 2050,542.5 2050,1007.5"
{{action "someAction"}}> </polygon> |
When I use onmouseover={{action "someAction"}} - it has similar problem |
I ran into this with FontAwesome 5. I didn't even get any console error messages. |
@MrChriZ @andressrg @fredguth @fyzwjd @krisselden @lifeart @lllama @mixonic @rwjblue @tonyhschu is this still an issue, perhaps we should close or create a new reproduction of this, what do you think? |
Closing for now, feel free to re-open if you can reproduce in the current release of Ember. |
This works great in Chrome, but without onclick, you can't get an event to make this work in Firefox. Any other workarounds? |
Adding
onclick={{action 'myAction'}}
to an svg element does not work as expected and throws an error.The action function seems to be inlined on the element. But still throws an error.
![screenshot 2016-04-26 19 04 50](https://cloud.githubusercontent.com/assets/127118/14837890/ccec8866-0be1-11e6-9073-8827bf168c42.png)
Reproduction twiddle: https://ember-twiddle.com/ab12e8e67d1fb5ae7783aa2703a13043?openFiles=templates.components.my-svg.hbs%2Ctemplates.components.my-svg.hbs
Here it works
-> console printsClicked!
The black SVG triangle
-> console printsUncaught SyntaxError: Unexpected token (
The text was updated successfully, but these errors were encountered: