Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move getSelection to Document and ShadowRoot; Mark ShadowRoot.getSelection as non-standard. #9431

Merged
merged 4 commits into from
Mar 12, 2021

Conversation

Elchi3
Copy link
Member

@Elchi3 Elchi3 commented Mar 11, 2021

Fixes #7891
Spec: https://w3c.github.io/selection-api/#extensions-to-document-interface

Delete getSelection from DocumentOrShadowRoot files and add it to Document. On Window, it already exists.

MDN content PR: mdn/content#3037

@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Mar 11, 2021
@foolip
Copy link
Contributor

foolip commented Mar 11, 2021

Chromium does have ShadowRoot#getSelection because it's in the DocumentOrShadowRoot mixin here:
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/dom/document_or_shadow_root.idl;l=12?q=shadow_root.idl

Also confirmed with https://mdn-bcd-collector.appspot.com/tests/api/ShadowRoot/getSelection

However, that entry isn't on the same footing as the one on Document. It should be marked as non-standard and supported only in Chromium browsers, presumably.

@foolip
Copy link
Contributor

foolip commented Mar 11, 2021

w3c/selection-api#114 is the spec issue for this situation.

foolip added a commit to foolip/browser-compat-data that referenced this pull request Mar 11, 2021
Prompted by mdn#9431 and
confirmed by mdn-bcd-collector results.
@foolip
Copy link
Contributor

foolip commented Mar 11, 2021

I've sent #9434. With that merged it should be a simple matter of moving the entries around.

Elchi3 pushed a commit that referenced this pull request Mar 12, 2021
…d as non-standard (#9434)

Prompted by #9431 and
confirmed by mdn-bcd-collector results.
@Elchi3
Copy link
Member Author

Elchi3 commented Mar 12, 2021

Thanks @foolip! Now this PR looks a bit more silly than before, but I guess it is still correct given the chromium implementation could remain non-standard.

Copy link
Contributor

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the other one also be moved and have its mdn_url either updated or removed?

@Elchi3
Copy link
Member Author

Elchi3 commented Mar 12, 2021

Moved It and removed the mdn_url.

We will see long-term if all this moving around makes sense. It doesn't change what BCD exposes after all.

Copy link
Contributor

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave merging to you, since the description needs updating.

@Elchi3 Elchi3 changed the title DocumentOrShadowRoot#getSelection doesn't exist Move getSelection to Document and ShadowRoot; Mark ShadowRoot.getSelection as non-standard. Mar 12, 2021
@Elchi3 Elchi3 merged commit 8ab2aaa into mdn:master Mar 12, 2021
@Elchi3 Elchi3 deleted the getSelection branch March 12, 2021 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move DocumentOrShadowRoot#getSelection to Document and Window
2 participants