mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-19 13:05:57 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user