Handle non-elements, like text nodes

This commit is contained in:
JC Brand 2018-12-17 14:38:00 +01:00
parent 9c812157ee
commit 94bcba741b
2 changed files with 5 additions and 3 deletions

3
dist/converse.js vendored
View File

@ -69716,7 +69716,8 @@ u.matchesSelector = function (el, selector) {
* (DOMElement) el - The DOM element
* (String) selector - The selector
*/
return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector);
const match = el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector;
return match ? match.call(el, selector) : false;
};
u.queryChildren = function (el, selector) {

View File

@ -179,14 +179,15 @@ u.matchesSelector = function (el, selector) {
* (DOMElement) el - The DOM element
* (String) selector - The selector
*/
return (
const match = (
el.matches ||
el.matchesSelector ||
el.msMatchesSelector ||
el.mozMatchesSelector ||
el.webkitMatchesSelector ||
el.oMatchesSelector
).call(el, selector);
);
return match ? match.call(el, selector) : false;
};
u.queryChildren = function (el, selector) {