I need a way of determining a parent element of the element at the mouse
position at the time of a double click.
Specifically I'd need to find the 'parent' header (H1, H2, H3, etc)
based on the DOM element that a user clicks on. Parent in this case
being the closest header in the stack, since DOM elements are not
children of header tags.
Thus, in a document structure below, when the user clicks on paragraph
2, the h3 DOM element is returned, click on paragraph 3 and the second
h2 is returned (where paragraphs are any valid DOM elements):
<h2>
paragraph 1
<h3>
paragraph 2
<h2>
paragraph 3
Thinking about it, I may be able to bind mouse events to all paragraphs,
and then determine the parent header -- problem there is the text under
the header could be any valid html, not just paragraphs; alternately
somehow find the mouse coordinates, and then the DOM element under those
coordinates...?
Suggestions and alternate approaches appreciated,
~ ~ Dave