Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 1f18285

Browse files
revert: fix($compile): Resolve leak with asynchronous compilation
This reverts commit 5c9c197. This "fix" is not yet ready for 1.2.x as it has lots of issues when JQuery is loaded.
1 parent 5036ac9 commit 1f18285

File tree

3 files changed

+6
-336
lines changed

3 files changed

+6
-336
lines changed

src/ng/compile.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -976,11 +976,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
976976

977977
function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
978978

979-
var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, containingScope) {
979+
var boundTranscludeFn = function(transcludedScope, cloneFn, controllers) {
980980
var scopeCreated = false;
981981

982982
if (!transcludedScope) {
983-
transcludedScope = scope.$new(false, containingScope);
983+
transcludedScope = scope.$new();
984984
transcludedScope.$$transcluded = true;
985985
scopeCreated = true;
986986
}
@@ -1592,7 +1592,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
15921592
transcludeControllers = elementControllers;
15931593
}
15941594

1595-
return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, scopeToChild);
1595+
return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers);
15961596
}
15971597
}
15981598
}
@@ -1754,8 +1754,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
17541754
boundTranscludeFn = linkQueue.shift(),
17551755
linkNode = $compileNode[0];
17561756

1757-
if (scope.$$destroyed) continue;
1758-
17591757
if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
17601758
var oldClasses = beforeTemplateLinkNode.className;
17611759

@@ -1786,7 +1784,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
17861784

17871785
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
17881786
var childBoundTranscludeFn = boundTranscludeFn;
1789-
if (scope.$$destroyed) return;
17901787
if (linkQueue) {
17911788
linkQueue.push(scope);
17921789
linkQueue.push(node);

src/ng/rootScope.js

+3-21
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,12 @@ function $RootScopeProvider(){
182182
* When creating widgets, it is useful for the widget to not accidentally read parent
183183
* state.
184184
*
185-
* @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will contain this
186-
* the newly created scope. Defaults to `this` scope if not provided.
187-
* This is used to ensure that $destroy events are handled correctly.
188-
*
189185
* @returns {Object} The newly created child scope.
190186
*
191187
*/
192-
$new: function(isolate, parent) {
193-
var child;
194-
195-
parent = parent || this;
188+
$new: function(isolate) {
189+
var ChildScope,
190+
child;
196191

197192
if (isolate) {
198193
child = new Scope();
@@ -225,19 +220,6 @@ function $RootScopeProvider(){
225220
} else {
226221
this.$$childHead = this.$$childTail = child;
227222
}
228-
229-
// When the new scope is not isolated or we inherit from `this`, and
230-
// the parent scope is destroyed, the property `$$destroyed` is inherited
231-
// prototypically. In all other cases, this property needs to be set
232-
// when the parent scope is destroyed.
233-
// The listener needs to be added after the parent is set
234-
if (isolate || parent != this) child.$on('$destroy', destroyChild);
235-
236-
237-
function destroyChild() {
238-
child.$$destroyed = true;
239-
}
240-
241223
return child;
242224
},
243225

0 commit comments

Comments
 (0)