Skip to content

Commit bbbf598

Browse files
committed
Remove DOCUMENT token
1 parent 899a346 commit bbbf598

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/cdk/overlay/keyboard/overlay-keyboard-dispatcher.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Inject, Injectable, Optional, SkipSelf, OnDestroy} from '@angular/core';
10-
import {DOCUMENT} from '@angular/platform-browser';
9+
import {Injectable, Optional, SkipSelf, OnDestroy} from '@angular/core';
1110
import {OverlayRef} from '../overlay-ref';
1211
import {Subscription} from 'rxjs/Subscription';
1312
import {RxChain, filter} from '@angular/cdk/rxjs';
@@ -26,8 +25,6 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
2625

2726
private _keydownEventSubscription: Subscription | null;
2827

29-
constructor(@Optional() @Inject(DOCUMENT) private _document: any) { }
30-
3128
ngOnDestroy() {
3229
if (this._keydownEventSubscription) {
3330
this._keydownEventSubscription.unsubscribe();
@@ -58,7 +55,7 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
5855
* events to the appropriate overlay.
5956
*/
6057
private _subscribeToKeydownEvents(): void {
61-
const bodyKeydownEvents = fromEvent<KeyboardEvent>(this._document.body, 'keydown');
58+
const bodyKeydownEvents = fromEvent<KeyboardEvent>(document.body, 'keydown');
6259

6360
this._keydownEventSubscription = RxChain.from(bodyKeydownEvents)
6461
.call(filter, () => !!this._attachedOverlays.length)
@@ -84,15 +81,15 @@ export class OverlayKeyboardDispatcher implements OnDestroy {
8481

8582
/** @docs-private */
8683
export function OVERLAY_KEYBOARD_DISPATCHER_PROVIDER_FACTORY(
87-
dispatcher: OverlayKeyboardDispatcher, _document) {
88-
return dispatcher || new OverlayKeyboardDispatcher(_document);
84+
dispatcher: OverlayKeyboardDispatcher) {
85+
return dispatcher || new OverlayKeyboardDispatcher();
8986
}
9087

9188
/** @docs-private */
9289
export const OVERLAY_KEYBOARD_DISPATCHER_PROVIDER = {
9390
// If there is already an OverlayKeyboardDispatcher available, use that.
9491
// Otherwise, provide a new one.
9592
provide: OverlayKeyboardDispatcher,
96-
deps: [[new Optional(), new SkipSelf(), OverlayKeyboardDispatcher], [new Optional(), DOCUMENT]],
93+
deps: [[new Optional(), new SkipSelf(), OverlayKeyboardDispatcher]],
9794
useFactory: OVERLAY_KEYBOARD_DISPATCHER_PROVIDER_FACTORY
9895
};

0 commit comments

Comments
 (0)