Skip to content

Commit

Permalink
fix: ensure proper namespace for title attr
Browse files Browse the repository at this point in the history
  • Loading branch information
nizamial09 authored Nov 29, 2024
1 parent a2a9228 commit 24ffbfe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/icon/icon.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit 24ffbfe

Please sign in to comment.