Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 95fdaf4

Browse files
committedMay 27, 2018
address review comments
1 parent 219c0f0 commit 95fdaf4

File tree

5 files changed

+4
-42
lines changed

5 files changed

+4
-42
lines changed
 

‎src/auto/injector.js

-19
Original file line numberDiff line numberDiff line change
@@ -914,19 +914,6 @@ function createInjector(modulesToLoad, strictDi) {
914914
return args;
915915
}
916916

917-
function isClass(func) {
918-
// Support: IE 9-11 only
919-
// IE 9-11 do not support classes and IE9 leaks with the code below.
920-
if (msie || typeof func !== 'function') {
921-
return false;
922-
}
923-
var result = func.$$ngIsClass;
924-
if (!isBoolean(result)) {
925-
result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func));
926-
}
927-
return result;
928-
}
929-
930917
function invoke(fn, self, locals, serviceName) {
931918
if (typeof locals === 'string') {
932919
serviceName = locals;
@@ -938,12 +925,6 @@ function createInjector(modulesToLoad, strictDi) {
938925
fn = fn[fn.length - 1];
939926
}
940927

941-
if (isClass(fn)) {
942-
// This code path was used by $controller previously and is not really needed any more.
943-
args.unshift(null);
944-
return new (Function.prototype.bind.apply(fn, args))();
945-
}
946-
947928
// http://jsperf.com/angularjs-invoke-apply-vs-switch
948929
// #5388
949930
return fn.apply(self, args);

‎src/ng/compile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
28192819
controllerConstructor = attrs[name];
28202820
}
28212821

2822-
var instance = $controller(controllerConstructor, locals, false, directive.controllerAs);
2822+
var instance = $controller(controllerConstructor, locals, directive.controllerAs);
28232823

28242824
$element.data('$' + name + 'Controller', instance);
28252825

‎src/ng/controller.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ function $ControllerProvider() {
8181
* It's just a simple call to {@link auto.$injector $injector}, but extracted into
8282
* a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
8383
*/
84-
return function $controller(expression, locals, _ignored, ident) {
84+
return function $controller(expression, locals, ident) {
8585
// PRIVATE API:
86-
// param `_ignored` --- not used, kept for compatibility with the $controller decorator in ngMock
8786
// param `ident` --- An optional label which overrides the label parsed from the controller
8887
// expression, if any.
8988
var instance, match, constructor, identifier;

‎src/ngMock/angular-mocks.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,8 @@ angular.mock.$RootElementProvider = function() {
23332333
function createControllerDecorator() {
23342334
angular.mock.$ControllerDecorator = ['$delegate', function($delegate) {
23352335
return function(expression, locals, bindings, ident) {
2336-
var instance = $delegate(expression, locals, false, ident);
2336+
if (angular.isString(bindings)) ident = bindings;
2337+
var instance = $delegate(expression, locals, ident);
23372338
angular.extend(instance, bindings);
23382339
return instance;
23392340
};

‎test/auto/injectorSpec.js

-19
Original file line numberDiff line numberDiff line change
@@ -482,25 +482,6 @@ describe('injector', function() {
482482
expect(instance).toEqual(new Clazz('a-value'));
483483
expect(instance.aVal()).toEqual('a-value');
484484
});
485-
486-
they('should detect ES6 classes regardless of whitespace/comments ($prop)', [
487-
'class Test {}',
488-
'class Test{}',
489-
'class //<--ES6 stuff\nTest {}',
490-
'class//<--ES6 stuff\nTest {}',
491-
'class {}',
492-
'class{}',
493-
'class //<--ES6 stuff\n {}',
494-
'class//<--ES6 stuff\n {}',
495-
'class/* Test */{}',
496-
'class /* Test */ {}'
497-
], function(classDefinition) {
498-
// eslint-disable-next-line no-eval
499-
var Clazz = eval('(' + classDefinition + ')');
500-
var instance = injector.invoke(Clazz);
501-
502-
expect(instance).toEqual(jasmine.any(Clazz));
503-
});
504485
}
505486
});
506487

0 commit comments

Comments
 (0)
This repository has been archived.