File tree Expand file tree Collapse file tree 7 files changed +17
-3
lines changed Expand file tree Collapse file tree 7 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,9 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
135135 MouseEvent createMouseEvent (String eventType) =>
136136 new MouseEvent (eventType, canBubble: true );
137137 Event createEvent (String eventType) => new Event (eventType, canBubble: true );
138+ void preventDefault (Event evt) {
139+ evt.preventDefault ();
140+ }
138141 String getInnerHTML (Element el) => el.innerHtml;
139142 String getOuterHTML (Element el) => el.outerHtml;
140143 void setInnerHTML (Element el, String value) {
Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ createMouseEvent(eventType: string): MouseEvent {
7777createEvent ( eventType ) : Event {
7878 return new Event ( eventType , true ) ;
7979}
80+ preventDefault ( evt : Event ) {
81+ evt . preventDefault ( ) ;
82+ evt . returnValue = false ;
83+ }
8084getInnerHTML ( el ) {
8185 return el . innerHTML ;
8286}
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export class DomAdapter {
3333 dispatchEvent ( el , evt ) { throw _abstract ( ) ; }
3434 createMouseEvent ( eventType ) : any { throw _abstract ( ) ; }
3535 createEvent ( eventType : string ) : any { throw _abstract ( ) ; }
36+ preventDefault ( evt ) { throw _abstract ( ) ; }
3637 getInnerHTML ( el ) : string { throw _abstract ( ) ; }
3738 getOuterHTML ( el ) : string { throw _abstract ( ) ; }
3839 nodeName ( node ) : string { throw _abstract ( ) ; }
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ class Html5LibDomAdapter implements DomAdapter {
7676 createEvent (eventType) {
7777 throw 'not implemented' ;
7878 }
79+ preventDefault (evt) {
80+ throw 'not implemented' ;
81+ }
7982 getInnerHTML (el) {
8083 return el.innerHtml;
8184 }
Original file line number Diff line number Diff line change @@ -134,6 +134,9 @@ export class Parse5DomAdapter extends DomAdapter {
134134 } ;
135135 return evt ;
136136 }
137+ preventDefault ( evt ) {
138+ evt . returnValue = false ;
139+ }
137140 getInnerHTML ( el ) {
138141 return serializer . serialize ( this . templateAwareRoot ( el ) ) ;
139142 }
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export class RouterLink {
5454 this . _location = location ;
5555 this . _params = StringMapWrapper . create ( ) ;
5656 DOM . on ( this . _domEl , 'click' , ( evt ) => {
57- evt . preventDefault ( ) ;
57+ DOM . preventDefault ( evt ) ;
5858 this . _router . navigate ( this . _navigationHref ) ;
5959 } ) ;
6060 }
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ export function main() {
221221 view . detectChanges ( ) ;
222222
223223 var dispatchedEvent = clickOnElement ( view ) ;
224- expect ( dispatchedEvent . defaultPrevented ) . toBe ( true ) ;
224+ expect ( dispatchedEvent . defaultPrevented || ! dispatchedEvent . returnValue ) . toBe ( true ) ;
225225
226226 // router navigation is async.
227227 rtr . subscribe ( ( _ ) => {
@@ -244,7 +244,7 @@ export function main() {
244244 view . detectChanges ( ) ;
245245
246246 var dispatchedEvent = clickOnElement ( view ) ;
247- expect ( dispatchedEvent . defaultPrevented ) . toBe ( true ) ;
247+ expect ( dispatchedEvent . defaultPrevented || ! dispatchedEvent . returnValue ) . toBe ( true ) ;
248248
249249 // router navigation is async.
250250 rtr . subscribe ( ( _ ) => {
You can’t perform that action at this time.
0 commit comments