Function: useSetAttribute()
useSetAttribute(
target,attr,value):void
Defined in: src/infrastructure/dom/dom.service.ts:250
Sets an attribute on the target element with XSS protection.
Blocks event-handler attributes (on*) and javascript: URLs.
Parameters
target
string | Element
A CSS selector string or an Element instance.
attr
string
The attribute name.
value
string
The value to set.
Returns
void
Throws
If the attribute is an event handler or contains a javascript: URL.
Example
useSetAttribute("img.hero", "src", "/photo.jpg");
useSetAttribute("a.link", "href", "https://example.com");