We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59fbce6 commit 14c1da8Copy full SHA for 14c1da8
src/index.ts
@@ -298,7 +298,11 @@ class MarkdownToolbarElement extends HTMLElement {
298
get field(): HTMLTextAreaElement | null {
299
const id = this.getAttribute('for')
300
if (!id) return null
301
- const field = (this.getRootNode() as Document | ShadowRoot).getElementById(id)
+ const root = this.getRootNode()
302
+ let field
303
+ if (root instanceof Document || root instanceof ShadowRoot) {
304
+ field = root.getElementById(id)
305
+ }
306
return field instanceof HTMLTextAreaElement ? field : null
307
}
308
0 commit comments