diff --git a/lib/ui/Dataview.mjs b/lib/ui/Dataview.mjs index 942bea3e0..ec8f4c20d 100644 --- a/lib/ui/Dataview.mjs +++ b/lib/ui/Dataview.mjs @@ -1,14 +1,15 @@ -export default async (_this, targetContainer) => { +export default async (_this, targetElement) => { - // if a target container is passed, use that to query - const queryDocument = targetContainer || document; + if (targetElement) { - // The dataview target is defined as string. - if (typeof _this.target === 'string') { - + // if a target element is passed, use that + _this.target = targetElement; + + } else if (typeof _this.target === 'string') { + + // The dataview target is defined as string. // assign target element by ID. - // must be querySelector - _this.target = queryDocument.querySelector(`#${_this.target}`); + _this.target = document.getElementById(_this.target); }