From bfe249f736ef61ad683bd110d29e06646e54e102 Mon Sep 17 00:00:00 2001 From: Alasdair McLeay Date: Fri, 27 Jan 2023 11:30:52 +0000 Subject: [PATCH] Support d3.drag in testing environments Return early from nodrag if no view is passed. Fixes #89 --- src/nodrag.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nodrag.js b/src/nodrag.js index 6076694..7246ce9 100644 --- a/src/nodrag.js +++ b/src/nodrag.js @@ -2,6 +2,9 @@ import {select} from "d3-selection"; import noevent, {nonpassivecapture} from "./noevent.js"; export default function(view) { + if(!view) { + return; + } var root = view.document.documentElement, selection = select(view).on("dragstart.drag", noevent, nonpassivecapture); if ("onselectstart" in root) {