useStyle: matching document.getElementById(id) when id is undefined could break css injection #17091
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
In useStyle.ts there is this code:
when we have not already injected a specific css (for example inputotp-variables)
id
isundefined
andthis.document.getElementById(id)
could match an element that hasid="undefined"
for example<span id="undefined">content</span>
causing a style issue for missing css.It is very uncommon (and ugly) to create an id with value "undefined" but this isn't forbidden by html rules.
Environment
Angular v18 webapp
Reproducer
https://stackblitz.com/edit/github-xypllzpu
Angular version
18.2.2
PrimeNG version
18.0.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
22.11.0
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
id="undefined"
must not break style injectionThe text was updated successfully, but these errors were encountered: