en.javascript.info/2-ui/2-events/03-event-delegation/2-sliding-tree/solution.md
Ilya Kantor ab9ab64bd5 up
2017-03-21 14:41:49 +03:00

302 B

The solution has two parts.

  1. 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).
  2. Set a handler to the tree root node and handle clicks on that <span> titles.