Skip to content

Commit cec9ecf

Browse files
committed
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.
1 parent 36a547b commit cec9ecf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ng/compile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
920920
} : noop;
921921

922922
compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo(element, scope, isolated, noTemplate) {
923-
safeAddClass(jqLite(element), isolated ? 'ng-isolate-scope' : 'ng-scope');
923+
safeAddClass(element, isolated ? 'ng-isolate-scope' : 'ng-scope');
924924
var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
925-
element.data ? element.data(dataName, scope) : jqLite.data(element, dataName, scope);
925+
element.data(dataName, scope);
926926
} : noop;
927927

928928
return compile;
@@ -1071,7 +1071,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
10711071
if (nodeLinkFn) {
10721072
if (nodeLinkFn.scope) {
10731073
childScope = scope.$new();
1074-
compile.$$addScopeInfo(node, childScope);
1074+
compile.$$addScopeInfo(jqLite(node), childScope);
10751075
} else {
10761076
childScope = scope;
10771077
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy