Skip to content

Commit 79fd194

Browse files
committed
simplify assignment
1 parent 1793237 commit 79fd194

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,10 @@ class MarkdownToolbarElement extends HTMLElement {
240240
const id = this.getAttribute('for')
241241
if (!id) return
242242
const root = this.getRootNode()
243-
const field =
244-
root instanceof Document
245-
? root.getElementById(id)
246-
: root instanceof DocumentFragment
247-
? root.querySelector(`#${id}`)
248-
: null
243+
let field = null
244+
if (root instanceof Document || root instanceof DocumentFragment) {
245+
field = root.querySelector(`#${id}`)
246+
}
249247
return field instanceof HTMLTextAreaElement ? field : null
250248
}
251249
}

0 commit comments

Comments
 (0)