Skip to content

Commit

Permalink
Merge pull request #8 from tchak/dev
Browse files Browse the repository at this point in the history
fix(dom): treat head and body selectors as a special case
  • Loading branch information
tchak authored Sep 1, 2023
2 parents 934a977 + dd2239c commit ccae2b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-eagles-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@coldwired/actions': patch
---

fix dispatch event
5 changes: 5 additions & 0 deletions packages/actions/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ function isMaterializedAction(action: Action | MaterializedAction): action is Ma
}

function getTargetElements(element: Element, selector: string) {
if (selector == 'head') {
return [element.ownerDocument.head];
} else if (selector == 'body') {
return [element.ownerDocument.body];
}
return [...element.querySelectorAll(selector)];
}

Expand Down

0 comments on commit ccae2b8

Please sign in to comment.