/** * @license * Copyright Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { SafeHtml } from '../internals/html_impl.js'; import { TrustedResourceUrl } from '../internals/resource_url_impl.js'; import { SafeScript } from '../internals/script_impl.js'; /** * Returns HTML-escaped text as a `SafeHtml` object. No-op if value is already a * SafeHtml instance. * * Available options: * - `preserveSpaces` turns every second consecutive space character into its * HTML entity representation (` `). * - `preserveNewlines` turns newline characters into breaks (`
`). * - `preserveTabs` wraps tab characters in a span with style=white-space:pre. */ export declare function htmlEscape(value: SafeHtml | string, options?: { preserveNewlines?: boolean; preserveSpaces?: boolean; preserveTabs?: boolean; }): SafeHtml; /** * Creates a `SafeHtml` representing a script tag with inline script content. */ export declare function scriptToHtml(script: SafeScript, options?: { defer?: boolean; id?: string; nonce?: string; type?: string; }): SafeHtml; /** * Creates a `SafeHtml` representing a script tag with the src attribute. * This also supports CSP nonces and async loading. */ export declare function scriptUrlToHtml(src: TrustedResourceUrl, options?: { async?: boolean; attributionSrc?: string; customElement?: string; defer?: boolean; id?: string; nonce?: string; type?: string; crossorigin?: 'anonymous' | 'use-credentials'; }): SafeHtml; /** Creates a `SafeHtml` value by concatenating multiple `SafeHtml`s. */ export declare function concatHtmls(htmls: ReadonlyArray): SafeHtml; /** * Creates a `SafeHtml` value by concatenating multiple `SafeHtml`s interleaved * with a separator. */ export declare function joinHtmls(separator: SafeHtml | string, htmls: ReadonlyArray): SafeHtml; /** * Returns a `SafeHtml` that contains ``. * This is defined as a function to prevent the definition of a Trusted Type * policy when simply importing safevalues. */ export declare function doctypeHtml(): SafeHtml; /** * Non-exported version of `nodeToHtml`, with an explicit temporary root to * accommodate for the sanitizer's user case. */ export declare function nodeToHtmlInternal(node: Node, temporaryRoot: Element): SafeHtml; /** * Serializes a Node into it's HTML representation. * * Note: this method uses strict XML serialization to mitigate mutation issues * when the html is then re-parsed by the browser. */ export declare function nodeToHtml(node: Node): SafeHtml;