Skip to content

Commit 7ec482d

Browse files
atscottthePunderWoman
authored andcommitted
fix(core): Add back support for namespace URIs in createElement of dom renderer (#44914)
Support for namespace URIs rather than short namespace names was added in 2b9cc85 to support how Ivy passed around the namespace URI rather than short name at the time. As a side-effect, this meant that namespace URIs were supported by the default dom renderer as part of the public API (likely unintentionally). It did not, however extend the support to other parts of the system (setAttribute, setAttribute, and the ServerRenderer). In the future we should decide what exactly the semantics for dealing with namespaces should be and make it consistent. fixes #44028 PR Close #44914
1 parent 98ba48e commit 7ec482d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/platform-browser/src/dom/dom_renderer.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ class DefaultDomRenderer2 implements Renderer2 {
145145

146146
createElement(name: string, namespace?: string): any {
147147
if (namespace) {
148-
return document.createElementNS(NAMESPACE_URIS[namespace], name);
148+
// TODO: `|| namespace` was added in
149+
// https://github.com/angular/angular/commit/2b9cc8503d48173492c29f5a271b61126104fbdb to
150+
// support how Ivy passed around the namespace URI rather than short name at the time. It did
151+
// not, however extend the support to other parts of the system (setAttribute, setAttribute,
152+
// and the ServerRenderer). We should decide what exactly the semantics for dealing with
153+
// namespaces should be and make it consistent.
154+
// Related issues:
155+
// https://github.com/angular/angular/issues/44028
156+
// https://github.com/angular/angular/issues/44883
157+
return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
149158
}
150159

151160
return document.createElement(name);

0 commit comments

Comments
 (0)