This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5864 - [selectors-api2] Add new method for filtering NodeLists
Summary: [selectors-api2] Add new method for filtering NodeLists
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Selectors API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement
Target Milestone: ---
Assignee: Lachlan Hunt
QA Contact: public-webapps-bugzilla
URL: http://lists.w3.org/Archives/Public/p...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-14 01:18 UTC by Lachlan Hunt
Modified: 2009-09-26 21:48 UTC (History)
3 users (show)

See Also:


Attachments

Description Lachlan Hunt 2008-07-14 01:18:58 UTC
Need to investigate use cases for this.  There was some prior discussion of this in IRC too with some suggestions.

http://krijnhoetmer.nl/irc-logs/whatwg/20080415#l-831

<Hixie> document.querySelector('a x').querySelector('b x') is equivalent to 'a b x, b a x' which can get much more complex
Comment 1 Lachlan Hunt 2009-09-23 09:44:56 UTC
Call this filterSelector() or something more appropriate.

Feedback based on JQuery indicates that NodeList.querySelector() would iteratively run the the method on all nodes in the list and return the combined result.
Comment 2 Lachlan Hunt 2009-09-24 12:28:17 UTC
This issue does not really have any specific use cases that are worth addressing with a dedicated API.  This can be covered by using the Array.filter() method with a callback function that uses a matches-selector API to determine if a given element matches.
Comment 3 Lachlan Hunt 2009-09-26 21:48:37 UTC
Re-resolving this as fixed as the scoped selector proposal in the current draft seems to adequately address the use cases as a side effect of the chosen solution for other cases.