Closed yndajas closed 2 months ago
I think one of the things I struggle with in these utils is we have to grab the DOM element we want to operate in in the util itself. It would be better if it was passed in.
We could try some basic dependency injection for this?
I think that we should have some functions that are responsible for making the DOM element available for these functions to use. Thinking of it in terms of a state chart when a state is transitioned to we could call some function which makes the DOM elements needed in that state available (if they are not already) as an 'entry' action and a function that is called as an 'exit' action to remove DOM nodes that are no longer needed. But that's not possible without first taking steps like this to make it easier.
This sounds interesting though. Curious what that might look like!
Closes #229