Skip to content

Commit

Permalink
Extend the getTargetRanges method documentation (mdn#30718)
Browse files Browse the repository at this point in the history
  • Loading branch information
jGowgiel authored and estelle committed Dec 5, 2023
1 parent 370adbf commit 0751cd8
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions files/en-us/web/api/inputevent/gettargetranges/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,44 @@ The **`getTargetRanges()`** method of the {{domxref("InputEvent")}} interface re

This allows web apps to override text edit behavior before the browser modifies the DOM tree, and provides more control over input events to improve performance.

Depending on the value of `inputType` and the current editing host, the expected return value of this method varies:

<table>
<thead>
<tr>
<th>inputType</th>
<th>Editing host</th>
<th>Response of <code>getTargetRanges()</code></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>"historyUndo"</code> or <code>"historyRedo"</code></td>
<td>Any</td>
<td>empty Array</td>
</tr>
<tr>
<td>All remaining</td>
<td><code>contenteditable</code></td>
<td>
an Array of
{{domxref("StaticRange")}}
objects associated with event
</td>
</tr>
<tr>
<td>All remaining</td>
<td>
<a href="/en-US/docs/Web/HTML/Element/input"><code>input</code></a>
or <a href="/en-US/docs/Web/HTML/Element/textarea"><code>textarea</code></a>
</td>
<td>
an empty Array
</td>
</tr>
</tbody>
</table>

## Syntax

```js-nolint
Expand Down

0 comments on commit 0751cd8

Please sign in to comment.