This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -851,9 +851,9 @@ function createInjector(modulesToLoad, strictDi) {
851
851
}
852
852
var result = func . $$ngIsClass ;
853
853
if ( ! isBoolean ( result ) ) {
854
- // Workaround for MS Edge.
855
- // Check https://connect .microsoft.com/IE/Feedback/Details/2211653
856
- result = func . $$ngIsClass = / ^ (?: c l a s s \s | c o n s t r u c t o r \( ) / . test ( stringifyFn ( func ) ) ;
854
+ // Support: Edge 12-13 only
855
+ // See: https://developer .microsoft.com/en-us/microsoft-edge/platform/issues/6156135/
856
+ result = func . $$ngIsClass = / ^ (?: c l a s s \b | c o n s t r u c t o r \( ) / . test ( stringifyFn ( func ) ) ;
857
857
}
858
858
return result ;
859
859
}
Original file line number Diff line number Diff line change @@ -302,6 +302,24 @@ describe('injector', function() {
302
302
expect ( instance . aVal ( ) ) . toEqual ( 'a-value' ) ;
303
303
} ) ;
304
304
305
+ they ( 'should detect ES6 classes regardless of whitespace/comments ($prop)' , [
306
+ 'class Test {}' ,
307
+ 'class Test{}' ,
308
+ 'class //<--ES6 stuff\nTest {}' ,
309
+ 'class//<--ES6 stuff\nTest {}' ,
310
+ 'class {}' ,
311
+ 'class{}' ,
312
+ 'class //<--ES6 stuff\n {}' ,
313
+ 'class//<--ES6 stuff\n {}' ,
314
+ 'class/* Test */{}' ,
315
+ 'class /* Test */ {}'
316
+ ] , function ( classDefinition ) {
317
+ var Clazz = eval ( '(' + classDefinition + ')' ) ;
318
+ var instance = injector . invoke ( Clazz ) ;
319
+
320
+ expect ( instance ) . toEqual ( jasmine . any ( Clazz ) ) ;
321
+ } ) ;
322
+
305
323
// Support: Chrome 50-51 only
306
324
// TODO (gkalpak): Remove when Chrome v52 is relased.
307
325
// it('should be able to invoke classes', function() {
You can’t perform that action at this time.
0 commit comments