Skip to content

Commit

Permalink
Exclude nodes without 'matches' (e.g. comment and text) from delegati…
Browse files Browse the repository at this point in the history
…on tests
  • Loading branch information
bmomberger-bitovi committed Oct 31, 2018
1 parent 39d3c16 commit aa9bcb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion helpers/-make-delegate-event-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function makeDelegator (domEvents) {
var el = cur === document ? document.documentElement : cur;
var matches = el.matches || el.msMatchesSelector;

if (matches.call(el, selector)) {
// Text and comment nodes may be included in mutation event targets
// but will never match selectors (and do not implement matches)
if (matches && matches.call(el, selector)) {
handlers.forEach(function(handler){
handler.call(el, ev);
});
Expand Down

0 comments on commit aa9bcb5

Please sign in to comment.