[Webkit-unassigned] [Bug 163921] Add selection API that works across shadow boundaries

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 2 17:12:04 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=163921

--- Comment #7 from Ryosuke Niwa <rniwa at webkit.org> ---
(In reply to Javan Makhmali from comment #6)
> > This is Chrome only API
> 
> Isn't it part of the spec
> (https://w3c.github.io/webcomponents/spec/shadow/#ranges-and-selections)? Or
> do you mean that only Chrome has implemented it?

That specification has been deprecated / superseded. See the warning at the very top which says:
> Shadow DOM specification is being upstreamed to DOM Standard [WHATWG-DOM], HTML Standard [HTML], CSS Scoping Module Level 1 [css-scoping-1], UI Events specification [uievents], and other relevant specifications. This specification may not accurately reflect the latest conclusion. See Issue #377 for details.


> > The latest proposal is to add getComposedRange
> 
> Interesting, thanks. It's a new API, not a replacement for getSelection(),
> right? https://github.com/w3c/selection-api/issues/98

window.getSelection() isn't going away anytime soon but no browser engine other than Blink has a plan or has demonstrated public support for having getSelection() on ShadowRoot.

> As it stands, I'd be happy with any API for getting the Selection/Range from
> a Shadow Root. It's possible to do in Chrome and Firefox currently, but not
> Safari (unless I'm missing something?).

I'm pretty sure it's not supported in Firefox. I tested 68.0a1 (2019-05-01) and 66.0.2 and both versions don't have it:

document.createElement('div').attachShadow({mode: 'open'}).getSelection()
TypeError: document.createElement(...).attachShadow(...).getSelection is not a function

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190503/f61412d0/attachment.html>


More information about the webkit-unassigned mailing list