so, in jQuery there's a transversal method called closest:
which you can supply a selector and it will travel up the DOM until it finds an element that matches.
in my case, I need to find the contenteditable div that a text node belongs to, so in jquery it would be something like:
I can't use jQuery in the code that I'm working on, but I need that functionality - the text node may be nested inside other elements, so doing parentNode.parentNode, etc is unreliable.
It only has to work on firefox, so query selectors
were looking promising, but they travel down from the specified element - I need something that travels up.
Does anybody know of anything in vanilla js that does something similar to jQuery's closest(), or am I stuck with walkin' the tree, or is there some other possible solution?
thanks in advance...