W3C home > Mailing lists > Public > public-webapps-bugzilla@w3.org > November 2012

[Bug 16488] Consider adding parent() / ancestor() method

From: <bugzilla@jessica.w3.org>
Date: Thu, 29 Nov 2012 11:47:34 +0000
To: public-webapps-bugzilla@w3.org
Message-ID: <bug-16488-2532-fUjhv3qsOW@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=16488

Anne <annevk@annevk.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arv@chromium.org,
                   |                            |ojan@chromium.org

--- Comment #2 from Anne <annevk@annevk.nl> ---
Okay, so basically this is the method that is desired:

Element.prototype.ancestor = function(selector) {
  var node = this
  while((node = node.parent) && node.nodeType == Node.ELEMENT_NODE)
    if(node.matches(selector))
      return node
  return null
}

Correct?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Thursday, 29 November 2012 11:47:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 29 November 2012 11:47:39 GMT