-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[ClickAwayListener] Remove misleading code comment #20743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Details of bundle changes.Comparing: ceb7cda...75dd869 Details of page changes
|
|
Well, I didn't really test it beyond just googling at @oliviertassinari's request, but I saw things like
timmywil/panzoom@d4f132c#diff-6a0dde1466e98b2125be19c4d7cd5077 also shows a refactoring of The comment is there to explain why we're not doing the more simple |
|
#20406 did not change how we call |
No, but we were trying to get the bundle size down and trying to think of ways we could do it. I suggested
I then dug up those links above, and he said
I agree with that, should be able to drop. |
Agree, it's worth trying to remove it out #20197 (comment) insideDOM =
- !(doc.documentElement && doc.documentElement.contains(event.target)) ||
+ !doc.documentElement.contains(event.target) || |
|
Maybe the comment could be updated to say something like // This check could've been made simpler with
// `doc.contains` (works in modern browsers),
// but it isn't supported in IE 11:
// https://github.com/timmywil/panzoom/issues/450
// https://github.com/videojs/video.js/pull/5872 |
104926b to
75dd869
Compare
| } else { | ||
| const doc = ownerDocument(nodeRef.current); | ||
| // TODO v6 remove dead logic https://caniuse.com/#search=composedPath. | ||
| // `doc.contains` works in modern browsers but isn't supported in IE 11: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there's no point mentioning doc.contains at all because this branch will be replaced entirely with event.composedPath in v6, and it's unlikely someone would try to drop documentElement from the code
In that code
.containsis always called onHTMLElementnever onDocument.HTMLElement.prototype.containsis supported down to IE9. The linked PRs are not concerned withHTMLElement.prototype.containsbutDocument.prototype.contains.@NMinhNguyen Could you clarify what the comment meant?