W3C home > Mailing lists > Public > www-style@w3.org > January 2014

Re: [selectors4] Upwards Ancestor Traversal API

From: Jirka Kosek <jirka@kosek.cz>
Date: Mon, 06 Jan 2014 23:03:44 +0100
Message-ID: <52CB2840.8020904@kosek.cz>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: www-style@w3.org
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 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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:38 UTC