Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
Thread: DOM transversal going upwards
02-19-2013, 03:40 PM #1
DOM transversal going upwards
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:
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...
02-19-2013, 05:03 PM #2
02-19-2013, 05:14 PM #3
that would... I'm always a little nervous about while loops, but I guess that would be the most logical
02-20-2013, 03:01 AM #4
- Join Date
- Jun 2007
- Thanked 567 Times in 548 Posts