Skip to content

Commit 24ffbfe

Browse files
authored
fix: ensure proper namespace for title attr
1 parent a2a9228 commit 24ffbfe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/icon/icon.directive.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export class IconDirective implements AfterViewInit, OnChanges {
8181
}
8282

8383
const svg = root.tagName.toUpperCase() !== "SVG" ? svgElement : root;
84-
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
84+
const xmlns = "http://www.w3.org/2000/svg";
85+
svg.setAttribute("xmlns", xmlns);
8586

8687
const attributes = getAttributes({
8788
width: icon.attrs.width,
@@ -110,7 +111,7 @@ export class IconDirective implements AfterViewInit, OnChanges {
110111
}
111112

112113
if (attributes["title"]) {
113-
const title = document.createElement("title");
114+
const title = document.createElementNS(xmlns, "title");
114115
title.textContent = attributes.title;
115116
IconDirective.titleIdCounter++;
116117
title.setAttribute("id", `${icon.name}-title-${IconDirective.titleIdCounter}`);

0 commit comments

Comments
 (0)