-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New highlight method #144
Comments
WOW. You have seriously made my week. Thank you for bringing my attention to an API so sorely absent from browsers and the spec, for such a long time! I'm quite certain this didn't exist when I originally (actively) developed Mark My Search, because I searched for alternate highlighting methods obsessively - it was my resolute conviction that we should be able to mark up a webpage without breaking it that led me to develop the PAINT highlighter. I am proud of what I achieved with PAINT, because for what it is, it has been surprisingly efficient at highlighting - but I never got it to work quite well enough. Although I'll likely remove PAINT at some point, I'll probably keep CLASSIC forever, mainly because it has potential for interaction with screenreaders. This API takes the cake however. Thank you again, and congrats on your extension! |
Your extension is excellent. I found your extension when I was looking for a way to highlight the text without modifying the DOM structure. I still can't understand some codes in the PAINT methods. Later, I found that the browser added a new Highlight API, which is very simple to use, but it does have some shortcomings, such as the screenreaders you mentioned. |
I'm glad you like it, thank you (:
I'm not too proud of my old code - in fact, I recently started a big effort to make it more approachable! Feel free to ask me about anything you're stuck on. This API will revolutionise the search-highlighter space for sure, and I hope it lands in Firefox soon too 😅 |
Now added to my answer on Stack Overflow. |
Great! I remember I saw this answer before. The advantage of using Highlight API is we don't need to create elements over text ranges, we can just style the Ranges, but without elements it's hard to interact with highlights, currently, I use |
@sapjax I'm commenting to let you know that I have completed my initial refactoring of the highlighter code. If you want to understand how PAINT works, it should now be easier! Old structure: PAINT and CLASSIC (now ELEMENT) highlighting functions were just roughly grouped together and called each other essentially at random. New structure:
That's a good point. Luckily MMS does not especially need highlight interaction, but it would definitely be a useful ability to have. |
I didn't mean to close this! However, the highlight engine ("HIGHLIGHT") is now at a very good stage, and I am trying to bring Mark My Search back to a releasable state after rewriting many of its components. Incidentally, it is possible to try out Firefox's implementation of the Custom Highlight API. It's not complete - for example, it currently lacks support for Here is preference to set in about:config:
|
https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API
https://developer.mozilla.org/en-US/docs/Web/API/Highlight
We can use the Highlight API above to highlight the text, which should be more efficient than the existing PAINT methods.
I have been using it in my extension for some time, and it works well.
The text was updated successfully, but these errors were encountered: