The OpaqueRange API lets you create ranges over the value of
<textarea> and <input> elements, enabling
getBoundingClientRect() and the
CSS Custom Highlight API
to work directly on form controls without cloning elements.
Give feedback on the
feature.
about://flags, or register for the
Origin Trial.
Type : in the textarea or the input field below to trigger an emoji picker positioned at the caret.
Type a search term in the search box below. All matching occurrences
in the textarea are highlighted in real time using the CSS Custom
Highlight API with OpaqueRange.
OpaqueRange is live: it automatically updates its offsets as
the content changes via interactive edits (typing, backspace, delete) or
setRangeText(). Click Highlight "world" to
highlight the word, then type before it and watch the highlight follow.
Calling range.disconnect() detaches the range from its element.
The offsets reset to 0, geometry becomes empty, and the range stops
receiving live updates. Create a range, then disconnect it and observe the
change.