Skip to content

Commit

Permalink
use the context’s document to create the input Event (#2169)
Browse files Browse the repository at this point in the history
closes #2159
  • Loading branch information
Fil authored Sep 11, 2024
1 parent 09edfec commit 2f26416
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function plot(options = {}) {
context.dispatchValue = (value) => {
if (figure.value === value) return;
figure.value = value;
figure.dispatchEvent(new Event("input", {bubbles: true}));
figure.dispatchEvent(new context.document.defaultView.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);
});

0 comments on commit 2f26416

Please sign in to comment.