From 24ffbfeb43d3173a2e6e0ed60874a20edbcad5e7 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Sat, 30 Nov 2024 04:31:24 +0530 Subject: [PATCH] fix: ensure proper namespace for title attr --- src/icon/icon.directive.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/icon/icon.directive.ts b/src/icon/icon.directive.ts index d912742020..57ae41eb9a 100644 --- a/src/icon/icon.directive.ts +++ b/src/icon/icon.directive.ts @@ -81,7 +81,8 @@ export class IconDirective implements AfterViewInit, OnChanges { } const svg = root.tagName.toUpperCase() !== "SVG" ? svgElement : root; - svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); + const xmlns = "http://www.w3.org/2000/svg"; + svg.setAttribute("xmlns", xmlns); const attributes = getAttributes({ width: icon.attrs.width, @@ -110,7 +111,7 @@ export class IconDirective implements AfterViewInit, OnChanges { } if (attributes["title"]) { - const title = document.createElement("title"); + const title = document.createElementNS(xmlns, "title"); title.textContent = attributes.title; IconDirective.titleIdCounter++; title.setAttribute("id", `${icon.name}-title-${IconDirective.titleIdCounter}`);