Re: [selectors4] Upwards Ancestor Traversal API

On 6.1.2014 19:13, Garrett Smith wrote:
> For event bubbling, it is very useful to traverse up the DOM tree to
> find an ancestor. For example:
> 
>  findAncestorWithClass(el, className,  /*opt*/ container);
>  findAncestorWithAttribute(el, attName, /*opt*/ value);
>  jqueryObj.closest(selectorText, /*opt*/ context)
> 
> It would be useful to have an API that traverses up the DOM tree and
> tests each Element against a selector and returns either an Element or
> null.

Wouldn't it be more suitable just to introduce additional selector which
will select ancestor nodes? Something similar to ancestor:: axis in
XPath. There will not be need for introducing new API then.

    Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
------------------------------------------------------------------
    Bringing you XML Prague conference    http://xmlprague.cz
------------------------------------------------------------------

Received on Monday, 6 January 2014 22:04:23 UTC