Skip to main content

Bug Tracker

Side navigation

#3586 closed enhancement (wontfix)

Opened November 09, 2008 06:53PM UTC

Closed November 11, 2010 01:17AM UTC

Add selector support for jQuery's data methods

Reported by: dekimsey Owned by:
Priority: major Milestone: 1.3
Component: selector Version: 1.2.6
Keywords: Cc: dekimsey, flesler
Blocked by: Blocking:
Description

jQuery's built in 'data methods' are great for storing tidbits of information into the nodes themselves. However tryign to find nodes in the dom containing certain data is not so easy, in fact, its rather messy $.filter(...) as far as jquery usually goes.

This is a feature request to add selector $(...) support for jquery's data methods.

$("div[:data.foo.bar=12]");

There by allowing one to query for all divs whose's data['foo']['bar'] value is 12.

Please note as of this time, this is not implementable via plugins as it requires an actual patch to the core javascript. It is possible this might be best done if/after Sizzle is implemented.

Discussion on the dev-jquery mailing list can be found here: http://groups.google.com/group/jquery-dev/browse_thread/thread/d74e5a88b9649d24?hl=en

Attachments (0)
Change History (5)

Changed November 10, 2008 02:40PM UTC by flesler comment:1

cc: → dekimsey, flesler
component: coreselector

Changed February 01, 2009 12:20PM UTC by balazs.endresz comment:2

I created a plugin page for the patch mentioned on the mailing list and updated to work with jQuery (1.3 only!):

http://plugins.jquery.com/project/EnhancedAttributeSelectors

Changed May 29, 2009 05:18AM UTC by ajpiano comment:3

This feature was added to the jQuery UI core with http://dev.jqueryui.com/browser/trunk/ui/ui.core.js?rev=454

It stands to reason that this would be in jQuery core instead - or that at least this issue is reviewed, as there is considerable interest in this selector.

Changed November 06, 2010 07:37PM UTC by dmethvin comment:4

keywords: → needsreview

Changed November 11, 2010 01:17AM UTC by dmethvin comment:5

keywords: needsreview
resolution: → wontfix
status: newclosed

We're not encouraging additions to the selector syntax because non-standard selectors prevent the use of native

querySelectorAll()
implementations supplied by browsers.

I can see this being implemented as a

.hasData( name [, value] )
filter method perhaps?