/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { DomAdapter } from '../dom/dom_adapter'; /** * This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML * that needs sanitizing. * Depending upon browser support we must use one of three strategies for doing this. * Support: Safari 10.x -> XHR strategy * Support: Firefox -> DomParser strategy * Default: InertDocument strategy */ export declare class InertBodyHelper { private defaultDoc; private DOM; private inertBodyElement; constructor(defaultDoc: any, DOM: DomAdapter); /** * Get an inert DOM element containing DOM created from the dirty HTML string provided. * The implementation of this is determined in the constructor, when the class is instantiated. */ getInertBodyElement: (html: string) => HTMLElement | null; /** * Use XHR to create and fill an inert body element (on Safari 10.1) * See * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449 */ private getInertBodyElement_XHR(html); /** * Use DOMParser to create and fill an inert body element (on Firefox) * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7 * */ private getInertBodyElement_DOMParser(html); /** * Use an HTML5 `template` element, if supported, or an inert body element created via * `createHtmlDocument` to create and fill an inert DOM element. * This is the default sane strategy to use if the browser does not require one of the specialised * strategies above. */ private getInertBodyElement_InertDocument(html); /** * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g. * 'ns1:xlink:foo'). * * This is undesirable since we don't want to allow any of these custom attributes. This method * strips them all. */ private stripCustomNsAttrs(el); }