Commit 8e6720b
fix(dialog): leaking MdDialogContainer references (#2944)
* fix(dialog): leaking MdDialogContainer references
Fixes an issue that caused the `MdDialogContainer` references to not be cleaned up, and as a result, any of the `MdDialogRef` and `MdDialogConfig` instances as well. The issue seems to come from the fact that a couple of blocks that look like:
```
this._ngZone.onMicrotaskEmpty.first().subscribe(() => {
this._elementFocusedBeforeDialogWasOpened = document.activeElement;
this._focusTrap.focusFirstTabbableElement();
});
```
End up being transpiled to:
```
var _this = this;
this._ngZone.onMicrotaskEmpty.first().subscribe(function () {
_this._elementFocusedBeforeDialogWasOpened = document.activeElement;
_this._focusTrap.focusFirstTabbableElement();
});
```
This seems to cause the browser to retain the `_this` reference after the dialog has been destroyed.
Fixes #2876.
* chore: add comment about `this` usage in zone1 parent 07bc4ad commit 8e6720b
1 file changed
+8
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 121 | + | |
| 122 | + | |
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
| |||
150 | 148 | | |
151 | 149 | | |
152 | 150 | | |
153 | | - | |
154 | | - | |
| 151 | + | |
155 | 152 | | |
156 | | - | |
157 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
162 | | - | |
| 161 | + | |
163 | 162 | | |
164 | 163 | | |
165 | 164 | | |
| |||
0 commit comments