fix(ivy): set namespace for host elements of dynamically created components (#35136)
Prior to this change, element namespace was not set for host elements of dynamically created components that resulted in incorrect rendering in a browser. This commit adds the logic to pick and set correct namespace for host element when component is created dynamically. PR Close #35136
This commit is contained in:

committed by
Kara Erickson

parent
d5d9971c28
commit
ae0253f34a
@ -174,7 +174,7 @@ class DefaultDomRenderer2 implements Renderer2 {
|
||||
setAttribute(el: any, name: string, value: string, namespace?: string): void {
|
||||
if (namespace) {
|
||||
name = namespace + ':' + name;
|
||||
// TODO(benlesh): Ivy may cause issues here because it's passing around
|
||||
// TODO(FW-811): Ivy may cause issues here because it's passing around
|
||||
// full URIs for namespaces, therefore this lookup will fail.
|
||||
const namespaceUri = NAMESPACE_URIS[namespace];
|
||||
if (namespaceUri) {
|
||||
@ -189,13 +189,13 @@ class DefaultDomRenderer2 implements Renderer2 {
|
||||
|
||||
removeAttribute(el: any, name: string, namespace?: string): void {
|
||||
if (namespace) {
|
||||
// TODO(benlesh): Ivy may cause issues here because it's passing around
|
||||
// TODO(FW-811): Ivy may cause issues here because it's passing around
|
||||
// full URIs for namespaces, therefore this lookup will fail.
|
||||
const namespaceUri = NAMESPACE_URIS[namespace];
|
||||
if (namespaceUri) {
|
||||
el.removeAttributeNS(namespaceUri, name);
|
||||
} else {
|
||||
// TODO(benlesh): Since ivy is passing around full URIs for namespaces
|
||||
// TODO(FW-811): Since ivy is passing around full URIs for namespaces
|
||||
// this could result in properties like `http://www.w3.org/2000/svg:cx="123"`,
|
||||
// which is wrong.
|
||||
el.removeAttribute(`${namespace}:${name}`);
|
||||
|
Reference in New Issue
Block a user