Cleans up the overlay from the DOM.
()
| 253 | |
| 254 | /** Cleans up the overlay from the DOM. */ |
| 255 | dispose(): void { |
| 256 | if (this._disposed) { |
| 257 | return; |
| 258 | } |
| 259 | |
| 260 | const isAttached = this.hasAttached(); |
| 261 | |
| 262 | if (this._positionStrategy) { |
| 263 | this._positionStrategy.dispose(); |
| 264 | } |
| 265 | |
| 266 | this._disposeScrollStrategy(); |
| 267 | this._backdropRef?.dispose(); |
| 268 | this._locationChanges.unsubscribe(); |
| 269 | this._keyboardDispatcher.remove(this); |
| 270 | this._portalOutlet.dispose(); |
| 271 | this._attachments.complete(); |
| 272 | this._backdropClick.complete(); |
| 273 | this._keydownEvents.complete(); |
| 274 | this._outsidePointerEvents.complete(); |
| 275 | this._outsideClickDispatcher.remove(this); |
| 276 | this._host?.remove(); |
| 277 | this._afterNextRenderRef?.destroy(); |
| 278 | this._previousHostParent = this._pane = this._host = this._backdropRef = null!; |
| 279 | |
| 280 | if (isAttached) { |
| 281 | this._detachments.next(); |
| 282 | } |
| 283 | |
| 284 | this._detachments.complete(); |
| 285 | this._completeDetachContent(); |
| 286 | this._disposed = true; |
| 287 | } |
| 288 | |
| 289 | /** Whether the overlay has attached content. */ |
| 290 | hasAttached(): boolean { |
no test coverage detected