Skip to content

Commit

Permalink
fix inspector cleanup (#1457)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jun 13, 2024
1 parent 0f2c92e commit 1b71e52
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/client/inspect.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {Inspector} from "observablehq:runtime";

export function inspect(value) {
const inspector = new Inspector(document.createElement("div"));
inspector.fulfilled(value);
return inspector._node.firstChild;
const node = document.createElement("div");
new Inspector(node).fulfilled(value);
return node;
}

export function inspectError(value) {
const inspector = new Inspector(document.createElement("div"));
inspector.rejected(value);
const node = inspector._node.firstChild;
const node = document.createElement("div");
new Inspector(node).rejected(value);
node.classList.add("observablehq--error");
return node;
}

0 comments on commit 1b71e52

Please sign in to comment.