302 B
302 B
The solution has two parts.
- Wrap every tree node title into
<span>
. Then we can CSS-style them on:hover
and handle clicks exactly on text, because<span>
width is exactly the text width (unlike without it). - Set a handler to the
tree
root node and handle clicks on that<span>
titles.