Skip to content

Files

Latest commit

 

History

History
23 lines (14 loc) · 502 Bytes

no-global-get-selection.md

File metadata and controls

23 lines (14 loc) · 502 Bytes

Pattern: Accessing selection with global

Issue: -

Description

Avoid accessing the selection with a global. Use the ownerDocument.defaultView property on a node ref instead.

Example of incorrect code:

window.getSelection();

Example of correct code:

defaultView.getSelection();

Further Reading