/** * @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 {Type} from '@angular/core'; var _DOM: DomAdapter = null; export function getDOM() { return _DOM; } export function setDOM(adapter: DomAdapter) { _DOM = adapter; } export function setRootDomAdapter(adapter: DomAdapter) { if (!_DOM) { _DOM = adapter; } } /* tslint:disable:requireParameterType */ /** * Provides DOM operations in an environment-agnostic way. * * @security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. */ export abstract class DomAdapter { public resourceLoaderType: Type = null; abstract hasProperty(element: any /** TODO #9100 */, name: string): boolean; abstract setProperty(el: Element, name: string, value: any): any /** TODO #9100 */; abstract getProperty(el: Element, name: string): any; abstract invoke(el: Element, methodName: string, args: any[]): any; abstract logError(error: any /** TODO #9100 */): any /** TODO #9100 */; abstract log(error: any /** TODO #9100 */): any /** TODO #9100 */; abstract logGroup(error: any /** TODO #9100 */): any /** TODO #9100 */; abstract logGroupEnd(): any /** TODO #9100 */; /** * Maps attribute names to their corresponding property names for cases * where attribute name doesn't match property name. */ get attrToPropMap(): {[key: string]: string} { return this._attrToPropMap; }; set attrToPropMap(value: {[key: string]: string}) { this._attrToPropMap = value; }; /** @internal */ _attrToPropMap: {[key: string]: string}; abstract parse(templateHtml: string): any /** TODO #9100 */; abstract query(selector: string): any; abstract querySelector(el: any /** TODO #9100 */, selector: string): HTMLElement; abstract querySelectorAll(el: any /** TODO #9100 */, selector: string): any[]; abstract on( el: any /** TODO #9100 */, evt: any /** TODO #9100 */, listener: any /** TODO #9100 */): any /** TODO #9100 */; abstract onAndCancel( el: any /** TODO #9100 */, evt: any /** TODO #9100 */, listener: any /** TODO #9100 */): Function; abstract dispatchEvent(el: any /** TODO #9100 */, evt: any /** TODO #9100 */): any /** TODO #9100 */; abstract createMouseEvent(eventType: any /** TODO #9100 */): any; abstract createEvent(eventType: string): any; abstract preventDefault(evt: any /** TODO #9100 */): any /** TODO #9100 */; abstract isPrevented(evt: any /** TODO #9100 */): boolean; abstract getInnerHTML(el: any /** TODO #9100 */): string; /** Returns content if el is a