Skip to content

Commit d408ec4

Browse files
authored
Cleanup
1 parent dc448e3 commit d408ec4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/cdk/a11y/focus-monitor/focus-monitor.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,11 @@ export class FocusMonitor implements OnDestroy {
139139
*/
140140
private _documentFocusAndBlurListener = (event: FocusEvent) => {
141141
const target = event.target as HTMLElement|null;
142+
const handler = event.type === 'focus' ? this._onFocus : this._onBlur;
143+
142144
// We need to walk up the ancestor chain in order to support `checkChildren`.
143145
for (let el = target; el; el = el.parentElement) {
144-
if (event.type === 'focus') {
145-
this._onFocus(event as FocusEvent, el);
146-
} else if (event.type === 'blur') {
147-
this._onBlur(event as FocusEvent, el);
148-
}
146+
handler.call(this, event, el);
149147
}
150148
}
151149

0 commit comments

Comments
 (0)