refactor($compile): $$addScopeInfo always expects jq wrapper

`$$addScopeInfo` used to accept either DOM Node or jqLite/jQuery
wrapper. This commit simplifies the method to always require
jqLite/jQuery wrapper and thus remove the `element.data` condition which
was wrong. If `element` was a raw comment element, the `data` property
was a string (the value of the comment) and an exception was thrown.
This commit is contained in:
Vojta Jina
2014-08-26 17:21:05 -07:00
parent 36a547b852
commit cec9ecf951

View File

@@ -920,9 +920,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
} : noop;
compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo(element, scope, isolated, noTemplate) {
safeAddClass(jqLite(element), isolated ? 'ng-isolate-scope' : 'ng-scope');
safeAddClass(element, isolated ? 'ng-isolate-scope' : 'ng-scope');
var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
element.data ? element.data(dataName, scope) : jqLite.data(element, dataName, scope);
element.data(dataName, scope);
} : noop;
return compile;
@@ -1071,7 +1071,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (nodeLinkFn) {
if (nodeLinkFn.scope) {
childScope = scope.$new();
compile.$$addScopeInfo(node, childScope);
compile.$$addScopeInfo(jqLite(node), childScope);
} else {
childScope = scope;
}