1 | /**
|
2 | * Escape string for use in HTML
|
3 | */
|
4 |
|
5 | /**
|
6 | * Escape special characters in the given string of text, such that it can be interpolated in HTML content.
|
7 | * This function will escape the following characters: `"`, `'`, `&`, `<`, and `>`.
|
8 | *
|
9 | * *Note* that the escaped value is only suitable for being interpolated into HTML as the text content of
|
10 | * elements in which the tag does not have different escaping mechanisms (it cannot be placed inside
|
11 | * `<style>` or `<script>`, for example, as those content bodies are not HTML, but CSS and JavaScript,
|
12 | * respectively; these are known as "raw text elements" in the HTML standard).
|
13 | *
|
14 | * *Note* when using the escaped value within a tag, it is only suitable as the value of an attribute,
|
15 | * where the value is quoted with either a double quote character (`"`) or a single quote character (`'`).
|
16 | */
|
17 | declare function escapeHTML(text?: string | null): string;
|
18 |
|
19 | export = escapeHTML;
|