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

feat($compile): support transcluding SVG nodes when there is no root <svg> node #7384

Closed
wants to merge 2 commits into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented May 7, 2014

This CL is a work in progress, and is not meant to be committed in this state.

Due to f0e12ea, it is now possible to have a directive whose template content is SVG.

However, the following issue arises:

A template like

<replaces-with-svg-and-transcludes>
  <g>
    <circle r=50 cx=0 cy=0 />
    <text>My circle!</text>
  </g>
</replaces-with-svg-and-transcludes>

Would not work as expected, due to the group, circle and text nodes being
parsed as HTMLUnknownElements, for not being parsed in an SVG context.

This change enables transcluded SVG content to work when parsed as non-HTML
content, with the cost of linking the transcluded elements again.

Fixes #7383

caitp added 2 commits May 7, 2014 12:38
…svg> node

Due to angular@f0e12ea, it is
now possible to have a directive whose template content is SVG.

However, the following issue arises:

A template like

    <replaces-with-svg-and-transcludes>
      <g>
        <circle r=50 cx=0 cy=0 />
        <text>My circle!</text>
      </g>
    </replaces-with-svg-and-transcludes>

Would not work as expected, due to the group, circle and text nodes being parsed as HTMLUnknownElements,
for not being parsed in an SVG context.

This change enables transcluded SVG content to work when parsed as non-HTML content, with the cost of
linking the transcluded elements again.
…uery used

`toHaveClass()` is a useful matcher, but unfortunately leverages jQuery/jqLite's hasClass() method.
jQuery's class API does not support SVG nodes, while angular's does. Therefore, some extra work
needs to be done to make this work for both libraries.
@caitp caitp self-assigned this May 7, 2014
@caitp caitp added this to the Backlog milestone May 7, 2014
@caitp caitp changed the title fix($compile): support transcluding SVG nodes when there is no root <svg> node feat($compile): support transcluding SVG nodes when there is no root <svg> node May 7, 2014
@caitp
Copy link
Contributor Author

caitp commented May 7, 2014

http://plnkr.co/edit/pGB1RWFKYMvUW0ImHqyE?p=preview plunkr from the original issue

@caitp
Copy link
Contributor Author

caitp commented May 7, 2014

Closing this, rationale in #7383 (comment)

@caitp caitp closed this May 7, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Templates of type SVG do not transclude elements properly
1 participant