Don't log for documentElement (nodeType 9)

Follow up to Ia011aaf9f8b5b932695da3311f849682c0105cfe

Bug: T340081
Change-Id: Ibff26eb90fd650532a7e23ac16232366676c0d15
This commit is contained in:
Jon Robson 2023-07-18 13:33:13 -07:00 committed by Jdlrobson
parent a80d2b1f56
commit 5af31b5524
3 changed files with 6 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View file

@ -145,6 +145,12 @@ function handleDOMEventIfEligible( handler ) {
target = target.parentNode;
}
// If the event bubbles up all the way,
// document does not have closest method, so exit early (T336650).
if ( target === document ) {
return;
}
// If the closest method is not defined, let's return early and
// understand this better by logging an error. (T340081)
if ( target && !target.closest ) {
@ -153,11 +159,6 @@ function handleDOMEventIfEligible( handler ) {
return;
}
// If the event bubbles up all the way,
// document does not have closest method, so exit early (T336650).
if ( target === document ) {
return;
}
target = findNearestEligibleTarget( target );
if ( target === null ) {
return;