dom::element target_item(const dom::element& ctl, dom::element target) { if( target == ctl ) return dom::element(); if( !target.is_valid() ) return target; dom::element target_parent = target.parent(); if( !target_parent.is_valid() ) return target; if( target.test("li > .caption") ) return target_parent; // only if click on "caption" element of <li>. Returns that <li> element. return target_item( ctl, target.parent() ); }
static inline bool is_in_focus(const dom::element& el) { return el.test(":focus") || el.find_nearest_parent(":focus"); }