Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ export function plot(options = {}) {
context.dispatchValue = (value) => {
if (figure.value === value) return;
figure.value = value;
figure.dispatchEvent(new Event("input", {bubbles: true}));
const Event = context.document.defaultView?.Event;
if (Event) figure.dispatchEvent(new Event("input", {bubbles: true}));
};

// Reinitialize; for deriving channels dependent on other channels.
Expand Down
8 changes: 8 additions & 0 deletions test/event-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Plot from "@observablehq/plot";
import * as assert from "assert";
import {JSDOM} from "jsdom";

it("Plot uses the context’s event", () => {
Plot.lineY([1, 2, 3], {tip: true}).plot({document: new JSDOM("").window.document});
assert.ok(true);
});