Open bedeoverend opened 7 years ago
I'm not too familiar with these APIs as I don't use them often. Happy to accept a PR of course!
Fair enough - I'm not too familiar either, but I'll take a crack when I can. Interestingly, the first Shadow DOM polyfill looks to have just called document.getSelection()
for shadowRoot.getSelection()
, might be able to be applied for a few of the methods in this interface 😕
Shadow DOM polyfill looks to have just called document.getSelection() for shadowRoot.getSelection(), might be able to be applied for a few of the methods in this interface 😕
I think that's probably fine. I know things like ShadowRoot.activeElement
is filled by simply doing document.activeElement
because there's no encapsulation.
Yeah though I'm not sure if there'd be repercussions of returning the document selection if that selection isn't encapsulated by the shadow root
Yeah, you'd probably have to test something like shadowRoot.contains(document.getSelection().anchorNode)
.
See https://github.com/webcomponents/shadydom/issues/113.
It seems only
activeElement
is implemented - it'd be great to have support for all methods / props in the interface. My use case is using Prosemirror which relies on the interface for managing selections. I'd be keen to have a crack at a PR, but don't have time right now.cc/ @treshugart - looks like you guys had this exact problem with WebKit, did you ever get around it?