Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions library/src/plugins/actions/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,15 @@ const dispatchFetch = (
type: string,
el: HTMLOrSVG,
argsRaw: Record<string, string>,
) =>
document.dispatchEvent(
) => {
const dispatchEl = el.isConnected ? el : document
dispatchEl.dispatchEvent(
new CustomEvent<DatastarFetchEvent>(DATASTAR_FETCH_EVENT, {
detail: { type, el, argsRaw },
bubbles: true,
}),
)
}

const isWrongContent = (err: any) => `${err}`.includes('text/event-stream')

Expand Down
1 change: 0 additions & 1 deletion library/src/plugins/attributes/on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ attribute({
const eventName = modifyCasing(key, mods, 'kebab')
// Listen for Datastar events on the document
if (
eventName === DATASTAR_FETCH_EVENT ||
eventName === DATASTAR_SIGNAL_PATCH_EVENT
) {
target = document
Expand Down