projectwallace / projectwallace/projectwallace.com
Use `OpaqueRange` for highlighting textarea when supported
Nobody has claimed this yet.
- Dominant language
- Svelte
- Stars
- 3
- Forks
- 0
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 11
Description
This could be a performance benefit for (for know only) Blink-based browsers that wouldn't need to copy the entire textarea contents into an extra div, sync the changes and perform the highlighting on that element.
See
- https://olliewilliams.xyz/blog/opaquerange/
- https://microsoftedge.github.io/MSEdgeExplainers/OpaqueRange/explainer.html
Example from https://olliewilliams.xyz/blog/opaquerange/:
const input = document.querySelector('input[type="text"]');
const startIndex = input.value.indexOf("example");
const myOpaqueRange = input.createValueRange(startIndex, startIndex + "example".length);
const greenHighlights = new Highlight(myOpaqueRange);
CSS.highlights.set("green", greenHighlights);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the OpaqueRange blog post and Microsoft Edge explainer first, then locate the textarea highlighting implementation that currently copies contents into an extra div. Check how Blink support can be detected and preserve the existing approach as a fallback; done means supported Blink browsers highlight without that extra copy and other browsers continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100