This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree 2 files changed +38
-4
lines changed
2 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,41 @@ describe('Zone.patch', function () {
359
359
} ) ;
360
360
} ) ;
361
361
362
+ describe ( 'WebKitMutationObserver' , function ( ) {
363
+ it ( 'should work' , function ( ) {
364
+ if ( ! window . WebKitMutationObserver ) {
365
+ console . log ( 'WARNING: skipping WebKitMutationObserver test (missing this API)' ) ;
366
+ return ;
367
+ }
368
+
369
+ var flag = false ,
370
+ elt = document . createElement ( 'div' ) ,
371
+ hasParent ;
372
+
373
+ runs ( function ( ) {
374
+ var ob = new WebKitMutationObserver ( function ( ) {
375
+ hasParent = ! ! window . zone . parent ;
376
+ flag = true ;
377
+ } ) ;
378
+
379
+ ob . observe ( elt , {
380
+ childList : true
381
+ } ) ;
382
+
383
+ elt . innerHTML = '<p>hey</p>' ;
384
+ } ) ;
385
+
386
+ waitsFor ( function ( ) {
387
+ return flag ;
388
+ } , 'mutation observer to fire' , 100 ) ;
389
+
390
+ runs ( function ( ) {
391
+ expect ( hasParent ) . toBe ( true ) ;
392
+ } ) ;
393
+
394
+ } ) ;
395
+ } ) ;
396
+
362
397
describe ( 'XMLHttpRequest' , function ( ) {
363
398
364
399
it ( 'should work with onreadystatechange' , function ( ) {
Original file line number Diff line number Diff line change @@ -267,9 +267,8 @@ Zone.patch = function patch () {
267
267
'catch'
268
268
] ) ;
269
269
}
270
- if ( window . MutationObserver ) {
271
- Zone . patchClass ( 'MutationObserver' ) ;
272
- }
270
+ Zone . patchClass ( 'MutationObserver' ) ;
271
+ Zone . patchClass ( 'WebKitMutationObserver' ) ;
273
272
} ;
274
273
275
274
//
@@ -333,7 +332,7 @@ Zone.patchClass = function (className) {
333
332
}
334
333
} ;
335
334
336
- var instance = new OriginalClass ( className === 'MutationObserver' ? function ( ) { } : undefined ) ;
335
+ var instance = new OriginalClass ( className . substr ( - 16 ) === 'MutationObserver' ? function ( ) { } : undefined ) ;
337
336
338
337
var prop ;
339
338
for ( prop in instance ) {
You can’t perform that action at this time.
0 commit comments