-
Notifications
You must be signed in to change notification settings - Fork 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
template doesn't work inside svg elements #1976
Comments
It looks like some code didn't make it over from 0.5 that explicitly addressed this issue. Template elements with a If anyone else is looking for a workaround, you can put this snippet at the top of your element's |
We also hit this issue, thanks for the workaround @bendavis78 . Will it be fixed in Polymer? |
@bendavis78 your snippet was a day saviour for me but it still has some problem. If you have more than one polymer element on the page and this svg element is not the first one the snippet breaks. This line:
should be changed so |
+1 |
1 similar comment
+1 |
Same error in Chrome 49, even with the tweaked version of svg-template-support.js, and also: |
+1 same error in latest chrome |
+1 |
1 similar comment
+1 |
Thanks for the workaround - would be really nice to have templates within SVG work natively ! |
Does anyone know of a way to implement the workaround while still vulcanizing elements? |
#3372 |
Note that the June 28, 2015 workaround does not work in Firefox 45.0.2 - it will actually prevent any of the svg from being rendered. |
Ran into this issue today. Any word on Polymer 1.0 support? |
+1 same error |
Although there is already a pull-request #3372 that could fix the namespace issue, here would be a work-around, that would build up the svg-node recursivly node by node. For that there could be a container-element:
and a element as svg-component, that creates the kind of svg-element, to be attached:
Property binding would have to be formally and also event-binding, but you could use that to do it automatically. It would definitely be better, that SVG namespace is implemented in Polymer as an option for registration of new elements . And in a test: plunker |
@fooloomanzii Thanks a lot for the workaround. You saved me a lot of time ! +1 for native implementation. |
+1 for native implementation |
+1 |
+1 |
1 similar comment
+1 |
+1 amazing to see one year later and still an issue |
+1 |
+1 |
@kevinpschaaf is this going to be possible in polymer 2 ? |
This is still an issue :( |
Provided a workaround for now, tested in FF/Safari/IE, bundled/unbundled. |
any official workaround here? |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
For people looking for a working solution, |
We have a proposal for a core solution: Detect if a The way to handle the transformation, is to expose a function This whole process ensures that the elements are parsed in the correct namespace, to make sure the actual nodes are created. Then once the parsing has completed, we can swap the correctly constructed nodes back into the template. We will be working on this issue this week to hopefully finally fix svg compatibility with templates + custom elements. |
Above comment has been implemented in #5135. Would be great to get some feedback whether this is actually working for your use-cases 🎉 |
Note full fix is blocked on webcomponents/shadycss#166 |
Is there a way forward with this issue? It seems like there is a Polymer solution (#5135) but it has been held back because of the possibility of addressing the issue at the platform level; however from what I can sense by reading whatwg/html#3553 and whatwg/html#3563 it does not seem that a platform level solution is likely any time soon. Update: It seems that this is solved in the new lit-html templating system (https://lit-html.polymer-project.org/guide), which is at release candidate stage (as of 17 December 2018). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen! |
For example:
This produces the following JS error:
The problem seems to be that the dom template object doesn't have a content property. This worked fine in Polymer 0.5.
Demo here: http://jsbin.com/wiqowo/31/edit?html,output
The text was updated successfully, but these errors were encountered: