Re: [w3c/selection-api] Specify Selection.modify()? (#37)

> I don't think we need to dispatch `beforeinput` for `Selection#modify()`, since we can use Proxy object or
manually override `Selection#modify()`.

I think we are misunderstanding each other. The point is not for the UA to dispatch a beforeinput event whenever `Selection#modify()` is used. The question is what to do when JS manually wants to trigger a beforeinput event as if it came from the browser. Some of the beforeinput events require a target range that is different from the selection -- for example `"deleteWordBackward"`. Now if I want to make a button to delete words backward, and I want it to behave exactly like the browser would when hitting the keyboard shortcut for deleting a word backward, I need to know what the browser would consider a word boundary when going backward from the current selection. `Selection#modify()` seems to be able to give me such a measurement, but I would need to lose my selection during the process of measuring it. The `Range#expand()` that @foolip seems more meaningful, as it could be used to measure without losing the selection.

Having access to a "visible character iterator" in JavaScript would also be helpful for parts of this, but it wouldn't help us much with finding softline breaks and alike. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/37#issuecomment-292102636

Received on Thursday, 6 April 2017 08:19:21 UTC