Skip to content

Commit

Permalink
Add comment explaining composedPath undefined check
Browse files Browse the repository at this point in the history
  • Loading branch information
ywsang committed Aug 4, 2020
1 parent 99be233 commit d30bcd7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ckeditor5-ui/src/bindings/clickoutsidehandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ export default function clickOutsideHandler( { emitter, activator, callback, con
return;
}

// Check if composedPath is undefined in case the browser does not support native shadow DOM
// Can be removed when all supported browsers support native shadow DOM
const path = domEvt.composedPath !== undefined ? domEvt.composedPath() : [];
for ( const contextElement of contextElements ) {
if ( contextElement.contains( domEvt.target ) ||
( 'composedPath' in domEvt && domEvt.composedPath().includes( contextElement ) ) ) {
if ( contextElement.contains( domEvt.target ) || path.includes( contextElement ) ) {
return;
}
}
Expand Down

0 comments on commit d30bcd7

Please sign in to comment.