Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fda99df

Browse files
committed
Fix Flow typecheck for root node
1 parent a38f736 commit fda99df

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/clipboard-copy-element.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function copy(button: HTMLElement) {
1414
copyText(text).then(trigger)
1515
} else if (id) {
1616
const root = 'getRootNode' in Element.prototype ? button.getRootNode() : button.ownerDocument
17+
if (!(root instanceof Document || ('ShadowRoot' in window && root instanceof ShadowRoot))) return
1718
const node = root.getElementById(id)
1819
if (node) copyTarget(node).then(trigger)
1920
}

0 commit comments

Comments
 (0)