Skip to content

Commit f6265b6

Browse files
committed
Add getrootNode fallback
1 parent 3ca8cad commit f6265b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class MarkdownToolbarElement extends HTMLElement {
298298
get field(): HTMLTextAreaElement | null {
299299
const id = this.getAttribute('for')
300300
if (!id) return null
301-
const root = this.getRootNode()
301+
const root = 'getRootNode' in this ? this.getRootNode() : document
302302
let field
303303
if (root instanceof Document || root instanceof ShadowRoot) {
304304
field = root.getElementById(id)

0 commit comments

Comments
 (0)