fix scoped js util initialization

This commit is contained in:
Felix Hamann 2019-04-15 21:13:18 +02:00
parent 5f6ab41ad8
commit fc8f37882e

View File

@ -62,7 +62,7 @@
console.log('setting up util', { util });
}
scope = scope || document;
scope = scope || document.body;
if (util && typeof util.setup === 'function') {
const elements = _findUtilElements(util, scope);
@ -96,6 +96,9 @@
}
function _findUtilElements(util, scope) {
if (scope && scope.matches(util.selector)) {
return [scope];
}
return Array.from(scope.querySelectorAll(util.selector));
}