From 25aae7b7603ca85d3ef57c766e54a39b646b72bb Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Thu, 30 Jul 2020 11:36:22 +0200 Subject: [PATCH] Fix `assert.dom(null).exists()` case https://github.com/simplabs/qunit-dom/pull/60 unintentionally broke the above case. This commit fixes the implementation by only defaulting to the `rootElement` as `target` when the user hasn't provided any arguments at all. --- lib/qunit-dom.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/qunit-dom.ts b/lib/qunit-dom.ts index 53ac39343..783ff410b 100644 --- a/lib/qunit-dom.ts +++ b/lib/qunit-dom.ts @@ -17,7 +17,12 @@ QUnit.assert.dom = function ( } rootElement = rootElement || this.dom.rootElement || document; - return new DOMAssertions(target || rootElement, rootElement, this); + + if (arguments.length === 0) { + target = rootElement; + } + + return new DOMAssertions(target, rootElement, this); }; function isValidRootElement(element: any): element is Element {