Skip to content

Commit

Permalink
changed target container param to target element
Browse files Browse the repository at this point in the history
  • Loading branch information
eo-uk committed Oct 18, 2023
1 parent 8baa85c commit 585fdd0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/ui/Dataview.mjs
Original file line number Diff line number Diff line change
@@ -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);

}

Expand Down

0 comments on commit 585fdd0

Please sign in to comment.