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

feat($compile, jqLite): Change directive definition object to allow temp... #5419

Closed
wants to merge 1 commit into from

Conversation

mikepro
Copy link

@mikepro mikepro commented Dec 15, 2013

...lates to be created within a given xml namespace

When creating a new directive and a template was specified, along with the replace option being set to true in the Directive Definition Object angular would create the elements contained within the template with the namespace of the HTML page. Whilst this is fine for the vast majority of the cases if you ever need to use xml in your template as in SVG this causes a problem. As the newly created elements are in the HTML namespace and not SVG.

This change introduces a new property on the Directive Definition Object "templateNS". This new property allows you to pass in a string to serve as the default namespace for the elements or to pass in an object. Where key is the xml prefix and value is the namespace.

@IgorMinar
Copy link
Contributor

I'm sorry, but I wasn't able to verify your CLA signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let me know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

…emplates to be created within a given xml namespace

When creating a new directive and a template was specified, along with the replace option being set to true in the Directive Definition Object angular would create the elements contained within the template with the namespace of the HTML page.  Whilst this is fine for the vast majority of the cases if you ever need to use xml in your template as in SVG this causes a problem. As the newly created elements are in the HTML namespace and not SVG.

This change introduces a new property on the Directive Definition Object "templateNS". This new property allows you to pass in a string to serve as the default namespace for the elements or to pass in an object.  Where key is the xml prefix and value is the namespace.
@IgorMinar
Copy link
Contributor

CLA signature verified! Thank you!

Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes).

@MikeMcElroy
Copy link
Contributor

Would be very interested in seeing something like this happen. The failing tests are for IE8 only, from what I can see, so this should probably be changed to the 1.3.x milestone.

As an aside, how often would you need to use an XML namespace other than SVG? Could we simplify things by only adding SVG support?

@mikepro
Copy link
Author

mikepro commented Jan 19, 2014

Yes that is right, the tests that were introduce as part of this pull request are only failing in IE 8. Unfortunately I don't have access to a machine with IE 8 installed on to try and debug this. From what I have read IE 8 does not natively support SVG(my prime motivation for submitting this pull request). I also remember reading that IE 8 support is planing to be discontinued in Angular 1.3. So I have been reluctant to put too much time into making it work and hoping for some feedback from the community to see how useful it is to have this feature supported in IE 8.

In answer to your other question about how often you would need to use another XML namespace. I would imagine that the vast majority of people (myself included) would use this purely for SVG. However there are a few other xml based documents that can potential be displayed in a browser the ones that I know of are MathML and RDF. I would like not to block developers from using Angular with those technologies just because of a namespace issue.

@caitp
Copy link
Contributor

caitp commented Jan 19, 2014

Hmm, we've got like 3 different solutions to this one issue now ;)

I think (hope) that the shadow dom will be a better solution to all of this, but I'm not totally sure.

@lgalfaso
Copy link
Contributor

Other solutions landed that would make svg automatically detected. If this is not the case, feel free to reopen this issue or create a new issue

@lgalfaso lgalfaso closed this Mar 13, 2015
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.

6 participants