diff --git a/static/js/services/utilRegistry.js b/static/js/services/utilRegistry.js index ca12f3d28..ada1f7d0f 100644 --- a/static/js/services/utilRegistry.js +++ b/static/js/services/utilRegistry.js @@ -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)); }