-
Notifications
You must be signed in to change notification settings - Fork 30
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
getComposedRange() review #161
Comments
Why is just returning |
Yeah, returning |
(I was thinking of what https://dom.spec.whatwg.org/#dom-range-range does, but returning null from the method makes sense as well.) |
Would there be some way to know the direction of a selection in a shadow tree if |
@andreubotella : yeah, maybe we want |
Other things worth tracking here:
|
Added direction property in cd5148f |
I prototyped getComposedRanges in WebKit: https://commits.webkit.org/260121@main |
…ray of StaticRange. This matches the prototype implementation of this API in WebKit. See #161
Renamed this function to |
Thanks for writing up the spec and getting a prototype started @rniwa! I need to dedicate some time to read through it in detail, but it would help if you could comment on whether/how it differs from the explainer we discussed before? Also, as part of the WebKit implementation, did you happen to write any WPTs? |
@mfreed7 : There are a few differences with that explainer. For starters, the method is called |
Interesting! Is there an issue discussing why
Any comment on this one? I didn't see any tests, but wanted to double-check. We are interested in also implementing this API later this year, and WPTs would help to make sure we're interoperable. |
So that it's consistent with the rest of selection APIs. If we ever wanted to add multi-range selection support, we don't want having to re-invent yet another API for that.
These two: |
@rniwa Any plan to merge them into WPT? Probably as tentative?
Also it simplifies Gecko's implementation since we probably need to make them able to return multiple ranges. |
I get that it simplifies Gecko's implementation, and it makes no implementation difference for Chromium/WebKit who only support a single selection. My concern is more about developers: a) multiple ranges are only supported on a single browser at the moment, and b) due to (a) I'm guessing there is an overwhelming volume of web code that just blindly does |
Our concern lies in having to add yet another API when that happens. There are increasingly more content that would warrant the support for multi-range selection: bidirectional text, flex box, etc... Since existing APIs are designed to work with multi-range selection, it would be only natural to parallel that in this API. |
Is WebKit planning to add multi-range selection? |
I cannot comment on our future plans but we're increasingly seeing the need for multi-range selection. |
WCCG had their spring F2F in which this was discussed. Present members of WCCG identifiers that there are several issues to resolve:
There was also a resolution to open two new issues to discuss further details; #163 and #164 have been opened. |
Start/end node cannot be null. I think we use some kind of default instead, such as "the body element"?
It seems that if you pass in the
ShadowRoot
instance start node is part of, this wouldn't result in a match. Which if you made a selection inside thatShadowRoot
instance doesn't seem to be what you want?One thing I'm missing here still is WICG/webcomponents#79 (comment). As we can no longer expose the true range directly we need to deal with that duality somehow, also for existing APIs such as
getRangeAt()
. That will require changes to both DOM and Selection.The text was updated successfully, but these errors were encountered: