Support Selection.empty(), Selection.setPosition()

RESOLVED FIXED in Firefox 55

Status

()

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: ayg, Assigned: ayg)

Tracking

({dev-doc-complete})

unspecified
mozilla55
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment)

https://github.com/w3c/selection-api/issues/36
https://github.com/w3c/selection-api/issues/38

These are from WebKit/Blink.  They're just aliases for removeAllRanges() and collapse().  They aren't good for much, but they are used in web content, so Blink wanted them added to the spec.  I don't see any reason to not remove them.  Edge reportedly supports empty().
Tests submitted upstream: https://github.com/w3c/web-platform-tests/pull/5684

Blink, WebKit, and Edge all support both of these methods.
Comment hidden (mozreview-request)
If you don't want to review yourself, could you pick someone else to review?
Flags: needinfo?(bugs)
I'm trying to reduce the very high reviewing throughput, so I'm experimenting keeping queue open only when I'm not working, and then every morning closing the queue and going through the existing requests.

mats and masayuki are other possible reviewers for this code, I think.

(r+ for the .webidl change)
Flags: needinfo?(bugs)
Attachment #8861400 - Flags: review?(masayuki)
Attachment #8861400 - Flags: review?(masayuki) → review?(bugs)
Comment on attachment 8861400 [details]
Bug 1359387 - Support Selection.empty()/setPosition()

https://reviewboard.mozilla.org/r/133394/#review136294

::: dom/webidl/Selection.webidl:29
(Diff revision 1)
> -    //void      empty();
> +		[Throws]
> +    void      empty();
>  		[Throws, BinaryName="collapseJS"]
>      void      collapse(Node? node, optional unsigned long offset = 0);
> -    //void      setPosition(Node? node, optional unsigned long offset = 0);
> +		[Throws]
> +    void      setPosition(Node? node, optional unsigned long offset = 0);

Although, this needs additional review of DOM peer.

::: dom/webidl/Selection.webidl:29
(Diff revision 1)
> -    //void      empty();
> +		[Throws]
> +    void      empty();
>  		[Throws, BinaryName="collapseJS"]
>      void      collapse(Node? node, optional unsigned long offset = 0);
> -    //void      setPosition(Node? node, optional unsigned long offset = 0);
> +		[Throws]
> +    void      setPosition(Node? node, optional unsigned long offset = 0);

Please replace tabs with whitespaces.

And cannot define this them as:

> [Throws, BinaryName="RemoveAllRanges"]
> void empty();

and

> [Throws, BinaryName="collapseJS"]
> void setPoisition(...);

?  Otherwise, r+ for the C++ part, but still needs DOM peer's review for webidl change.
Attachment #8861400 - Flags: review+

Comment 6

2 years ago
mozreview-review
Comment on attachment 8861400 [details]
Bug 1359387 - Support Selection.empty()/setPosition()

https://reviewboard.mozilla.org/r/133394/#review136324

Ah, masayuki is right. Using BinaryName would be quite handy here, especially since the spec explicitly talks about methods being aliases.
And don't use tabs but spaces.
Attachment #8861400 - Flags: review?(bugs) → review+
Comment hidden (mozreview-request)

Comment 8

2 years ago
Pushed by ayg@aryeh.name:
https://hg.mozilla.org/integration/autoland/rev/24b122474ff5
Support Selection.empty()/setPosition() r=masayuki,smaug

Comment 9

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/24b122474ff5
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
I've documented this by adding details on the aliases to (and updating browser compat info on):

https://developer.mozilla.org/en-US/docs/Web/API/Selection_API
https://developer.mozilla.org/en-US/docs/Web/API/Selection

And of course I've added a note to the Fx55 rel notes:

https://developer.mozilla.org/en-US/Firefox/Releases/55#DOM_HTML_DOM
(In reply to Chris Mills (Mozilla, MDN editor) [:cmills] from comment #10)
> I've documented this by adding details on the aliases to (and updating
> browser compat info on):
> 
> https://developer.mozilla.org/en-US/docs/Web/API/Selection_API
> https://developer.mozilla.org/en-US/docs/Web/API/Selection
> 
> And of course I've added a note to the Fx55 rel notes:
> 
> https://developer.mozilla.org/en-US/Firefox/Releases/55#DOM_HTML_DOM

Thanks, looks fine to me. Although, it might be better to separate the row of the compat table for each method.
(In reply to Masayuki Nakano [:masayuki] (JST, +0900) (PTO: 5/26) from comment #11)
> (In reply to Chris Mills (Mozilla, MDN editor) [:cmills] from comment #10)
> > I've documented this by adding details on the aliases to (and updating
> > browser compat info on):
> > 
> > https://developer.mozilla.org/en-US/docs/Web/API/Selection_API
> > https://developer.mozilla.org/en-US/docs/Web/API/Selection
> > 
> > And of course I've added a note to the Fx55 rel notes:
> > 
> > https://developer.mozilla.org/en-US/Firefox/Releases/55#DOM_HTML_DOM
> 
> Thanks, looks fine to me. Although, it might be better to separate the row
> of the compat table for each method.

OK, done.
You need to log in before you can comment on or make changes to this bug.