-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Templates of type SVG do not transclude elements properly #7383
Comments
I don't think we can fix this easily. The problem is, the HTML Parser tells us we have The only way that we can turn them into SVG nodes, is to A) wait until we have a template, B) wrap them in an element like the parent element, and C) re-compile the compiled nodes. It's doable, but it's not very good, you know? Maybe I'll see if I can make this work, but I wouldn't really expect much. The jenga tower is pretty shaky already |
I got. It was much easier to deal with replacing the parent since you had it all in the template. I'll see if I can come up with any clever ideas and ping the thread if I do |
@christang you might try out that patch and see if you can find things that are broken with it. It's pretty crap and not ship-able at all right now, so it needs a lot of work to get there. |
Most of it looks good, but for one case with svg in the template, the transclude function is injecting strings of undefined rather than the expected node. I've updated the plunker here http://plnkr.co/edit/pGB1RWFKYMvUW0ImHqyE?p=preview. I figure extra eyes might help in case I missed something. |
Because the first childNodes are textNodes, I guess. That's an easy fix |
Got it. Stripping out the whitespace makes it work perfectly |
It's not actually that easy to fix, because we do craziness like wrap text nodes in spans, and that breaks the SVG element... Might be possible to do away with the span wrapping. |
I've noticed that in the code. Just curious. Why do we do the span wrapping On Wed, May 7, 2014 at 3:57 PM, Caitlin Potter notifications@github.comwrote:
|
the span-wrapping predates my time contributing to angular, so I don't know exactly. It may have been to simplify data binding, I'm not sure --- actually, probably something about text nodes not being able to have an expando store in JQ or something |
@christang so I brought it up with Igor, and yeah, it's kinda too much craziness to add. So you're going to have to use a real I don't think we can land a fix for it (although people are certainly welcome to try, I'll review em). I'm going to close this because I don't think this is really feasible in a good way. |
no worries @caitp. there's lots of new expressivity in the last few days of On Wed, May 7, 2014 at 5:48 PM, Caitlin Potter notifications@github.comwrote:
|
@christang @caitp I'm confused. commits f0e12ea introduced a
|
The issue is that if you now want to transclude into gWithTransclusion what On Mon, Aug 4, 2014 at 10:27 PM, merlinchen notifications@github.com
|
@caitp @christang beta18: http://plnkr.co/edit/0nNPCIV8WiRybl6rU6Wd Summary of the 'results': Should I open a new issue? |
@antoinepairet the |
👍 Perfect. Many thanks for the quick answer. That's how it goes when using a beta version. :-) |
@antoinepairet https://github.com/antoinepairet Thanks for the note. I've On Wed, Aug 27, 2014 at 5:14 PM, Antoine Pairet notifications@github.com
|
@caitp @antoinepairet @christang There is a regression between 18 and 19 when using svg directive with ngRepeat. When click the add button, a new element will be pushed into the array. In beta 18, everything works fine. But in beta 19, the |
Hmm, that is weird, it is repeating <my-rect> but not replacing it with the template. @tbosch what do you think? |
@merlinchen could you please file a separate bug for that so we can track it correctly? it does look like a regression to me |
This may be related to issue #7265, which was closed after feature release. (Issues #6778 and #5418 appear to be related, but duplicates.)
In that release, directives of type SVG and MathML became possible using replace: true. However, this currently works only with directives that do not have transclusions. For example:
and directive:
fails to render the inner rectangle. Inspecting the elements reveal they're in the wrong namespace. The new feature hasn't been extended to transclusions yet.
Plunker:
http://plnkr.co/edit/pGB1RWFKYMvUW0ImHqyE?p=preview
Way to fix: let's add the feature to transclusions.
The text was updated successfully, but these errors were encountered: