This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -1177,7 +1177,6 @@ const Zone: ZoneType = (function(global: any) {
1177
1177
type : this . type ,
1178
1178
state : this . state ,
1179
1179
source : this . source ,
1180
- data : this . data ,
1181
1180
zone : this . zone . name ,
1182
1181
invoke : this . invoke ,
1183
1182
scheduleFn : this . scheduleFn ,
Original file line number Diff line number Diff line change @@ -312,6 +312,32 @@ describe('Zone', function() {
312
312
} ) ;
313
313
} ) ;
314
314
} ) ;
315
+
316
+ it ( 'should be able to covert element with event listener to json without cyclic error' ,
317
+ function ( ) {
318
+ const eventListenerSpy = jasmine . createSpy ( 'eventListener' ) ;
319
+ let elemThrowErrorWhenToJson = false ;
320
+ try {
321
+ JSON . stringify ( button ) ;
322
+ } catch ( err ) {
323
+ elemThrowErrorWhenToJson = true ;
324
+ }
325
+
326
+ // in chrome mobile, dom element will throw
327
+ // cyclic error when call JSON.stringify,
328
+ // so we just ignore it.
329
+ if ( elemThrowErrorWhenToJson ) {
330
+ return ;
331
+ }
332
+
333
+ Zone . current . run ( function ( ) {
334
+ button . addEventListener ( 'click' , eventListenerSpy ) ;
335
+ } ) ;
336
+
337
+ expect ( function ( ) {
338
+ JSON . stringify ( button ) ;
339
+ } ) . not . toThrow ( ) ;
340
+ } ) ;
315
341
} ) ;
316
342
} ) ;
317
343
} ) ;
You can’t perform that action at this time.
0 commit comments