Skip to content

Commit cffa9cf

Browse files
authored
fix(material/icon): do not copy event attributes (#33929)
Adds some logic so that attributes like `onclick` aren't copied when creating an SVG icon from a symbol.
1 parent 84a2366 commit cffa9cf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/material/icon/icon-registry.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,9 @@ export class MatIconRegistry implements OnDestroy {
593593
// Copy over all the attributes from the `symbol` to the new SVG, except the id.
594594
for (let i = 0; i < attributes.length; i++) {
595595
const {name, value} = attributes[i];
596+
const lowercasedName = name.toLowerCase();
596597

597-
if (name !== 'id') {
598+
if (lowercasedName !== 'id' && !lowercasedName.startsWith('on')) {
598599
svg.setAttribute(name, value);
599600
}
600601
}

0 commit comments

Comments
 (0)