Dom range api in Elm


I am looking for a way to use dom range api (or selection)

in a Elm context (not using port).
Is that exist for 0.19 ?

Thx for your answers.

1 Like

I think unless someone from the core team implements something, the best you can do is a web component. That worked fine for me but I ended up using ports in the end as I had a simple use case.

I think the answer is no.

You can listen to selection events from pure Elm, but this event does not tell you much that is useful. The next thing you might want to do is to get the selection and range:


And there is no built-in Elm API for this.

By chance, I have been working a good amount with the Selection API recently. I found the best way for me to integrate it into Elm was through custom elements. You can find my work in progress code here:


Thx very much. I will look at your work. Very useful.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.