11import { isBlank } from 'angular2/src/core/facade/lang' ;
2- import { BaseException , WrappedException } from 'angular2/src/core/facade/exceptions' ;
32
43export var DOM : DomAdapter ;
54
@@ -9,137 +8,129 @@ export function setRootDomAdapter(adapter: DomAdapter) {
98 }
109}
1110
12-
13-
14- function _abstract ( ) {
15- return new BaseException ( 'This method is abstract' ) ;
16- }
17-
1811/* tslint:disable:requireParameterType */
1912/**
2013 * Provides DOM operations in an environment-agnostic way.
2114 */
22- export class DomAdapter {
23- hasProperty ( element , name : string ) : boolean { throw _abstract ( ) ; }
24- setProperty ( el : Element , name : string , value : any ) { throw _abstract ( ) ; }
25- getProperty ( el : Element , name : string ) : any { throw _abstract ( ) ; }
26- invoke ( el : Element , methodName : string , args : any [ ] ) : any { throw _abstract ( ) ; }
15+ export abstract class DomAdapter {
16+ abstract hasProperty ( element , name : string ) : boolean ;
17+ abstract setProperty ( el : Element , name : string , value : any ) ;
18+ abstract getProperty ( el : Element , name : string ) : any ;
19+ abstract invoke ( el : Element , methodName : string , args : any [ ] ) : any ;
2720
28- logError ( error ) { throw _abstract ( ) ; }
29- log ( error ) { throw _abstract ( ) ; }
30- logGroup ( error ) { throw _abstract ( ) ; }
31- logGroupEnd ( ) { throw _abstract ( ) ; }
21+ abstract logError ( error ) ;
22+ abstract log ( error ) ;
23+ abstract logGroup ( error ) ;
24+ abstract logGroupEnd ( ) ;
3225
3326 /**
3427 * Maps attribute names to their corresponding property names for cases
3528 * where attribute name doesn't match property name.
3629 */
37- get attrToPropMap ( ) : StringMap < string , string > { throw _abstract ( ) ; }
30+ attrToPropMap : StringMap < string , string > ;
3831
39- parse ( templateHtml : string ) { throw _abstract ( ) ; }
40- query ( selector : string ) : any { throw _abstract ( ) ; }
41- querySelector ( el , selector : string ) : HTMLElement { throw _abstract ( ) ; }
42- querySelectorAll ( el , selector : string ) : any [ ] { throw _abstract ( ) ; }
43- on ( el , evt , listener ) { throw _abstract ( ) ; }
44- onAndCancel ( el , evt , listener ) : Function { throw _abstract ( ) ; }
45- dispatchEvent ( el , evt ) { throw _abstract ( ) ; }
46- createMouseEvent ( eventType ) : any { throw _abstract ( ) ; }
47- createEvent ( eventType : string ) : any { throw _abstract ( ) ; }
48- preventDefault ( evt ) { throw _abstract ( ) ; }
49- isPrevented ( evt ) : boolean { throw _abstract ( ) ; }
50- getInnerHTML ( el ) : string { throw _abstract ( ) ; }
51- getOuterHTML ( el ) : string { throw _abstract ( ) ; }
52- nodeName ( node ) : string { throw _abstract ( ) ; }
53- nodeValue ( node ) : string { throw _abstract ( ) ; }
54- type ( node ) : string { throw _abstract ( ) ; }
55- content ( node ) : any { throw _abstract ( ) ; }
56- firstChild ( el ) : Node { throw _abstract ( ) ; }
57- nextSibling ( el ) : Node { throw _abstract ( ) ; }
58- parentElement ( el ) : Node { throw _abstract ( ) ; }
59- childNodes ( el ) : Node [ ] { throw _abstract ( ) ; }
60- childNodesAsList ( el ) : Node [ ] { throw _abstract ( ) ; }
61- clearNodes ( el ) { throw _abstract ( ) ; }
62- appendChild ( el , node ) { throw _abstract ( ) ; }
63- removeChild ( el , node ) { throw _abstract ( ) ; }
64- replaceChild ( el , newNode , oldNode ) { throw _abstract ( ) ; }
65- remove ( el ) : Node { throw _abstract ( ) ; }
66- insertBefore ( el , node ) { throw _abstract ( ) ; }
67- insertAllBefore ( el , nodes ) { throw _abstract ( ) ; }
68- insertAfter ( el , node ) { throw _abstract ( ) ; }
69- setInnerHTML ( el , value ) { throw _abstract ( ) ; }
70- getText ( el ) : string { throw _abstract ( ) ; }
71- setText ( el , value : string ) { throw _abstract ( ) ; }
72- getValue ( el ) : string { throw _abstract ( ) ; }
73- setValue ( el , value : string ) { throw _abstract ( ) ; }
74- getChecked ( el ) : boolean { throw _abstract ( ) ; }
75- setChecked ( el , value : boolean ) { throw _abstract ( ) ; }
76- createComment ( text : string ) : any { throw _abstract ( ) ; }
77- createTemplate ( html ) : HTMLElement { throw _abstract ( ) ; }
78- createElement ( tagName , doc = null ) : HTMLElement { throw _abstract ( ) ; }
79- createTextNode ( text : string , doc = null ) : Text { throw _abstract ( ) ; }
80- createScriptTag ( attrName : string , attrValue : string , doc = null ) : HTMLElement {
81- throw _abstract ( ) ;
82- }
83- createStyleElement ( css : string , doc = null ) : HTMLStyleElement { throw _abstract ( ) ; }
84- createShadowRoot ( el ) : any { throw _abstract ( ) ; }
85- getShadowRoot ( el ) : any { throw _abstract ( ) ; }
86- getHost ( el ) : any { throw _abstract ( ) ; }
87- getDistributedNodes ( el ) : Node [ ] { throw _abstract ( ) ; }
88- clone /*<T extends Node>*/ ( node : Node /*T*/ ) : Node /*T*/ { throw _abstract ( ) ; }
89- getElementsByClassName ( element , name : string ) : HTMLElement [ ] { throw _abstract ( ) ; }
90- getElementsByTagName ( element , name : string ) : HTMLElement [ ] { throw _abstract ( ) ; }
91- classList ( element ) : any [ ] { throw _abstract ( ) ; }
92- addClass ( element , classname : string ) { throw _abstract ( ) ; }
93- removeClass ( element , classname : string ) { throw _abstract ( ) ; }
94- hasClass ( element , classname : string ) : boolean { throw _abstract ( ) ; }
95- setStyle ( element , stylename : string , stylevalue : string ) { throw _abstract ( ) ; }
96- removeStyle ( element , stylename : string ) { throw _abstract ( ) ; }
97- getStyle ( element , stylename : string ) : string { throw _abstract ( ) ; }
98- tagName ( element ) : string { throw _abstract ( ) ; }
99- attributeMap ( element ) : Map < string , string > { throw _abstract ( ) ; }
100- hasAttribute ( element , attribute : string ) : boolean { throw _abstract ( ) ; }
101- getAttribute ( element , attribute : string ) : string { throw _abstract ( ) ; }
102- setAttribute ( element , name : string , value : string ) { throw _abstract ( ) ; }
103- removeAttribute ( element , attribute : string ) { throw _abstract ( ) ; }
104- templateAwareRoot ( el ) { throw _abstract ( ) ; }
105- createHtmlDocument ( ) : HTMLDocument { throw _abstract ( ) ; }
106- defaultDoc ( ) : HTMLDocument { throw _abstract ( ) ; }
107- getBoundingClientRect ( el ) { throw _abstract ( ) ; }
108- getTitle ( ) : string { throw _abstract ( ) ; }
109- setTitle ( newTitle : string ) { throw _abstract ( ) ; }
110- elementMatches ( n , selector : string ) : boolean { throw _abstract ( ) ; }
111- isTemplateElement ( el : any ) : boolean { throw _abstract ( ) ; }
112- isTextNode ( node ) : boolean { throw _abstract ( ) ; }
113- isCommentNode ( node ) : boolean { throw _abstract ( ) ; }
114- isElementNode ( node ) : boolean { throw _abstract ( ) ; }
115- hasShadowRoot ( node ) : boolean { throw _abstract ( ) ; }
116- isShadowRoot ( node ) : boolean { throw _abstract ( ) ; }
117- importIntoDoc /*<T extends Node>*/ ( node : Node /*T*/ ) : Node /*T*/ { throw _abstract ( ) ; }
118- adoptNode /*<T extends Node>*/ ( node : Node /*T*/ ) : Node /*T*/ { throw _abstract ( ) ; }
119- isPageRule ( rule ) : boolean { throw _abstract ( ) ; }
120- isStyleRule ( rule ) : boolean { throw _abstract ( ) ; }
121- isMediaRule ( rule ) : boolean { throw _abstract ( ) ; }
122- isKeyframesRule ( rule ) : boolean { throw _abstract ( ) ; }
123- getHref ( element ) : string { throw _abstract ( ) ; }
124- getEventKey ( event ) : string { throw _abstract ( ) ; }
125- resolveAndSetHref ( element , baseUrl : string , href : string ) { throw _abstract ( ) ; }
126- cssToRules ( css : string ) : any [ ] { throw _abstract ( ) ; }
127- supportsDOMEvents ( ) : boolean { throw _abstract ( ) ; }
128- supportsNativeShadowDOM ( ) : boolean { throw _abstract ( ) ; }
129- getGlobalEventTarget ( target : string ) : any { throw _abstract ( ) ; }
130- getHistory ( ) : History { throw _abstract ( ) ; }
131- getLocation ( ) : Location { throw _abstract ( ) ; }
132- getBaseHref ( ) : string { throw _abstract ( ) ; }
133- resetBaseElement ( ) : void { throw _abstract ( ) ; }
134- getUserAgent ( ) : string { throw _abstract ( ) ; }
135- setData ( element , name : string , value : string ) { throw _abstract ( ) ; }
136- getComputedStyle ( element ) : any { throw _abstract ( ) ; }
137- getData ( element , name : string ) : string { throw _abstract ( ) ; }
138- setGlobalVar ( name : string , value : any ) { throw _abstract ( ) ; }
139- requestAnimationFrame ( callback ) : number { throw _abstract ( ) ; }
140- cancelAnimationFrame ( id ) { throw _abstract ( ) ; }
141- performanceNow ( ) : number { throw _abstract ( ) ; }
142- getAnimationPrefix ( ) : string { throw _abstract ( ) ; }
143- getTransitionEnd ( ) : string { throw _abstract ( ) ; }
144- supportsAnimation ( ) : boolean { throw _abstract ( ) ; }
32+ abstract parse ( templateHtml : string ) ;
33+ abstract query ( selector : string ) : any ;
34+ abstract querySelector ( el , selector : string ) : HTMLElement ;
35+ abstract querySelectorAll ( el , selector : string ) : any [ ] ;
36+ abstract on ( el , evt , listener ) ;
37+ abstract onAndCancel ( el , evt , listener ) : Function ;
38+ abstract dispatchEvent ( el , evt ) ;
39+ abstract createMouseEvent ( eventType ) : any ;
40+ abstract createEvent ( eventType : string ) : any ;
41+ abstract preventDefault ( evt ) ;
42+ abstract isPrevented ( evt ) : boolean ;
43+ abstract getInnerHTML ( el ) : string ;
44+ abstract getOuterHTML ( el ) : string ;
45+ abstract nodeName ( node ) : string ;
46+ abstract nodeValue ( node ) : string ;
47+ abstract type ( node ) : string ;
48+ abstract content ( node ) : any ;
49+ abstract firstChild ( el ) : Node ;
50+ abstract nextSibling ( el ) : Node ;
51+ abstract parentElement ( el ) : Node ;
52+ abstract childNodes ( el ) : Node [ ] ;
53+ abstract childNodesAsList ( el ) : Node [ ] ;
54+ abstract clearNodes ( el ) ;
55+ abstract appendChild ( el , node ) ;
56+ abstract removeChild ( el , node ) ;
57+ abstract replaceChild ( el , newNode , oldNode ) ;
58+ abstract remove ( el ) : Node ;
59+ abstract insertBefore ( el , node ) ;
60+ abstract insertAllBefore ( el , nodes ) ;
61+ abstract insertAfter ( el , node ) ;
62+ abstract setInnerHTML ( el , value ) ;
63+ abstract getText ( el ) : string ;
64+ abstract setText ( el , value : string ) ;
65+ abstract getValue ( el ) : string ;
66+ abstract setValue ( el , value : string ) ;
67+ abstract getChecked ( el ) : boolean ;
68+ abstract setChecked ( el , value : boolean ) ;
69+ abstract createComment ( text : string ) : any ;
70+ abstract createTemplate ( html ) : HTMLElement ;
71+ abstract createElement ( tagName , doc ?) : HTMLElement ;
72+ abstract createTextNode ( text : string , doc ?) : Text ;
73+ abstract createScriptTag ( attrName : string , attrValue : string , doc ?) : HTMLElement ;
74+ abstract createStyleElement ( css : string , doc ?) : HTMLStyleElement ;
75+ abstract createShadowRoot ( el ) : any ;
76+ abstract getShadowRoot ( el ) : any ;
77+ abstract getHost ( el ) : any ;
78+ abstract getDistributedNodes ( el ) : Node [ ] ;
79+ abstract clone /*<T extends Node>*/ ( node : Node /*T*/ ) : Node /*T*/ ;
80+ abstract getElementsByClassName ( element , name : string ) : HTMLElement [ ] ;
81+ abstract getElementsByTagName ( element , name : string ) : HTMLElement [ ] ;
82+ abstract classList ( element ) : any [ ] ;
83+ abstract addClass ( element , classname : string ) ;
84+ abstract removeClass ( element , classname : string ) ;
85+ abstract hasClass ( element , classname : string ) : boolean ;
86+ abstract setStyle ( element , stylename : string , stylevalue : string ) ;
87+ abstract removeStyle ( element , stylename : string ) ;
88+ abstract getStyle ( element , stylename : string ) : string ;
89+ abstract tagName ( element ) : string ;
90+ abstract attributeMap ( element ) : Map < string , string > ;
91+ abstract hasAttribute ( element , attribute : string ) : boolean ;
92+ abstract getAttribute ( element , attribute : string ) : string ;
93+ abstract setAttribute ( element , name : string , value : string ) ;
94+ abstract removeAttribute ( element , attribute : string ) ;
95+ abstract templateAwareRoot ( el ) ;
96+ abstract createHtmlDocument ( ) : HTMLDocument ;
97+ abstract defaultDoc ( ) : HTMLDocument ;
98+ abstract getBoundingClientRect ( el ) ;
99+ abstract getTitle ( ) : string ;
100+ abstract setTitle ( newTitle : string ) ;
101+ abstract elementMatches ( n , selector : string ) : boolean ;
102+ abstract isTemplateElement ( el : any ) : boolean ;
103+ abstract isTextNode ( node ) : boolean ;
104+ abstract isCommentNode ( node ) : boolean ;
105+ abstract isElementNode ( node ) : boolean ;
106+ abstract hasShadowRoot ( node ) : boolean ;
107+ abstract isShadowRoot ( node ) : boolean ;
108+ abstract importIntoDoc /*<T extends Node>*/ ( node : Node /*T*/ ) : Node /*T*/ ;
109+ abstract adoptNode /*<T extends Node>*/ ( node : Node /*T*/ ) : Node /*T*/ ;
110+ abstract isPageRule ( rule ) : boolean ;
111+ abstract isStyleRule ( rule ) : boolean ;
112+ abstract isMediaRule ( rule ) : boolean ;
113+ abstract isKeyframesRule ( rule ) : boolean ;
114+ abstract getHref ( element ) : string ;
115+ abstract getEventKey ( event ) : string ;
116+ abstract resolveAndSetHref ( element , baseUrl : string , href : string ) ;
117+ abstract cssToRules ( css : string ) : any [ ] ;
118+ abstract supportsDOMEvents ( ) : boolean ;
119+ abstract supportsNativeShadowDOM ( ) : boolean ;
120+ abstract getGlobalEventTarget ( target : string ) : any ;
121+ abstract getHistory ( ) : History ;
122+ abstract getLocation ( ) : Location ;
123+ abstract getBaseHref ( ) : string ;
124+ abstract resetBaseElement ( ) : void ;
125+ abstract getUserAgent ( ) : string ;
126+ abstract setData ( element , name : string , value : string ) ;
127+ abstract getComputedStyle ( element ) : any ;
128+ abstract getData ( element , name : string ) : string ;
129+ abstract setGlobalVar ( name : string , value : any ) ;
130+ abstract requestAnimationFrame ( callback ) : number ;
131+ abstract cancelAnimationFrame ( id ) ;
132+ abstract performanceNow ( ) : number ;
133+ abstract getAnimationPrefix ( ) : string ;
134+ abstract getTransitionEnd ( ) : string ;
135+ abstract supportsAnimation ( ) : boolean ;
145136}
0 commit comments