[Webkit-unassigned] [Bug 273469] New: Selection API: returns live range, but need an option to return new range object for new selection

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 30 00:54:44 PDT 2024


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

            Bug ID: 273469
           Summary: Selection API: returns live range, but need an option
                    to return new range object for new selection
           Product: WebKit
           Version: Safari 17
          Hardware: Unspecified
                OS: macOS 14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: harshitg0202 at gmail.com

Hi, a new change in selection and range API has broken my code for a custom find feature in the latest Safari v17.

When I use the window.getSelection().getRangeAt(0) on Safari v16, I get new range objects whenever the selection changes.

But in the latest Safari v17,  window.getSelection().getRangeAt(0) returns always the same range object (updated with new data).

This behavior differs from any other browser on windows, linux or mac.

Sharing an example snippet here: https://jsfiddle.net/zb85nhx6/1/.
Trying running this in different browsers and check the console.

This took of lot of debugging to figure out why my code was broken for only latest Safari on Mac.

Kindly either fix this behavior to make it seamless with other browsers, or provide an API to turn off live ranges.

-- 
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/20240430/d6754a2a/attachment.htm>


More information about the webkit-unassigned mailing list