Shadow DOM selection page

This page demos detecting the selection range within a shadow root, for Safari, which does not yet support ShadowRoot.getSelection. (It still works in Chromium and Firefox, it just uses the native versions.)

Note that Chromium and Safari allow selection across Shadow DOM boundaries, sometimes with unpredictable results. Please provide feedback if you have opinions or real-world experience with this problem.

Selection

Content is below me
I'm some content in the DOM
^^ That's my host above