Clear selection in WebKit2 Web Extension without JavaScript

90 views Asked by At

I want to clear the selection from a web extension.

There is a signal selection-changed, but there does not seem to have a way to clear the selection.

I tried creating a WebKitDOMRange but it seems there is no way to set this new range in the document. And it does not seem to have a way to get the current range.

How can I clear the selection from a WebKit2 web extension without using a JavaScript string?

1

There are 1 answers

0
antoyo On BEST ANSWER

WebKit2 seems to have an unstable API that does not appear in the documentation.

I was able to get the current selection with the webkit_dom_dom_window_get_selection and clearing it with webkit_dom_dom_selection_empty