This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
As specified in http://dvcs.w3.org/hg/webcomponents/rev/3fb19f98bead, window.getSelection() may never retrieve content from shadow DOM subtrees. Also, a user can't select content from both document tree and shadow DOM tree. We must fix that somehow.
Should we allow shadow DOM subtrees to specify whether they want to be treated as part of "as-rendered" structure or as a separate subtree? Currently, for getSelection(), the WebKit implementation returns serialized value of the Selection object inside of a shadow DOM subtree, but node values are adjusted to avoid leaking shadow DOM nodes.
This is an important UX concern. I think it's fine to limit access to selection data as defined by the spec. However, users expect to be able to select and copy text in a web page. To have that limited by invisible ShadowDOM boundaries would be very annoying. Ideally, this just always works and is separate from the encapsulation provided via ShadowDOM.
One thing that Jonas suggested at the recent spec review is to make our selection language non-normative. It's a tough subject, so we shouldn't freeze this into the spec. The suggestion was to have the language along these lines: "Selection is not defined. Implementation should do their best to do what's best for them. Here's one possible, admittedly naive way: <insert current normative wording, but make it informative>"
(In reply to Dimitri Glazkov from comment #3) > One thing that Jonas suggested at the recent spec review is to make our > selection language non-normative. It's a tough subject, so we shouldn't > freeze this into the spec. The suggestion was to have the language along > these lines: > > "Selection is not defined. Implementation should do their best to do what's > best for them. Here's one possible, admittedly naive way: <insert current > normative wording, but make it informative>" Done at https://github.com/w3c/webcomponents/commit/25bd518701866866a26d9d7e3e50d90a45f62d93. I'll keep this bug open until we have a better model, that is a tough issue for us.
(In reply to Hayato Ito from comment #4) > (In reply to Dimitri Glazkov from comment #3) > > One thing that Jonas suggested at the recent spec review is to make our > > selection language non-normative. It's a tough subject, so we shouldn't > > freeze this into the spec. The suggestion was to have the language along > > these lines: > > > > "Selection is not defined. Implementation should do their best to do what's > > best for them. Here's one possible, admittedly naive way: <insert current > > normative wording, but make it informative>" > > Done at > https://github.com/w3c/webcomponents/commit/ > 25bd518701866866a26d9d7e3e50d90a45f62d93. > > I'll keep this bug open until we have a better model, that is a tough issue > for us. Maybe kill the 6.1.1 section title and remove the musty language from the non-normative parts?
(In reply to Dimitri Glazkov from comment #5) > Maybe kill the 6.1.1 section title and remove the musty language from the > non-normative parts? Sure. Done at https://github.com/w3c/webcomponents/commit/0887618b6f247d1d59f37fbc474313014d81f227
*** Bug 25038 has been marked as a duplicate of this bug. ***
Status Update: This bug is still on our radar, but we couldn't spend much time on this issue in terms of the spec. FYI. In Blink, we are working on supporting selection across shadow boundaries [1]. However, there is no update on API in the spec yet. [1]: https://code.google.com/p/chromium/issues/detail?id=275851
Moved to https://github.com/w3c/webcomponents/issues/79