Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4609f07

Browse files
fix: removing fallback code for compareDocumentPosition
1 parent c3fe206 commit 4609f07

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

‎projects/angular-datetimerangepicker/src/daterangepicker/daterangepicker.component.ts‎

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,36 +62,25 @@ export class Daterangepicker implements OnInit, DoCheck, OnChanges {
6262
@HostListener('document:mouseup', ['$event'])
6363
@HostListener('document:keyup', ['$event'])
6464
handleOutsideClick(event) {
65+
console.log(event);
6566
if (!this.derivedOptions.disabled) {
66-
let current: any = event.target;
67+
const current: any = event.target;
6768
const host: any = this.elem.nativeElement;
68-
if (host.compareDocumentPosition) {
69-
if (
70-
host.compareDocumentPosition(current) &
71-
window.Node.DOCUMENT_POSITION_CONTAINED_BY
72-
) {
73-
this.storeOldDates();
74-
return this.toggleCalendars(true);
75-
}
76-
} else if (host.contains) {
77-
if (host.contains(current)) {
78-
this.storeOldDates();
79-
return this.toggleCalendars(true);
69+
if (
70+
host.compareDocumentPosition(current) &
71+
window.Node.DOCUMENT_POSITION_CONTAINED_BY
72+
) {
73+
if (event.key === 'Escape') {
74+
return this.toggleCalendars(false);
8075
}
81-
} else {
82-
do {
83-
if (current === host) {
84-
this.storeOldDates();
85-
return this.toggleCalendars(true);
86-
}
87-
current = current.parentNode;
88-
} while (current);
76+
this.storeOldDates();
77+
return this.toggleCalendars(true);
8978
}
9079
if (this.showCalendars) {
9180
if (!this.derivedOptions.autoApply) {
9281
this.restoreOldDates();
9382
}
94-
this.toggleCalendars(false);
83+
returnthis.toggleCalendars(false);
9584
}
9685
}
9786
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /