Saltar al contenido principal

Function: useSetHtml()

useSetHtml(target, html): void

Defined in: src/infrastructure/dom/dom.service.ts:399

Sets innerHTML on the target element.

XSS risk: this is an HTML injection sink. Never pass unsanitized user input. Prefer useSetText for plain text, or sanitize with a trusted library (e.g. DOMPurify) before calling this function.

Parameters

target

string | Element

A CSS selector string or an Element instance.

html

string

The HTML string to set.

Returns

void

Example

// Safe — trusted static markup
useSetHtml("#banner", "<strong>Hello</strong>");

// Unsafe — do NOT do this with user content
// useSetHtml("#out", userInput);