Bug Tracker

Opened 14 years ago

Closed 12 years ago

#3586 closed enhancement (wontfix)

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:


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 datafoo?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

Change History (5)

comment:1 Changed 14 years ago by flesler

Cc: dekimsey flesler added
Component: coreselector

comment:2 Changed 14 years ago by balazs.endresz

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

comment:3 Changed 14 years ago by ajpiano

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.

comment:4 Changed 12 years ago by dmethvin

Keywords: needsreview added

comment:5 Changed 12 years ago by dmethvin

Keywords: needsreview removed
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?

Note: See TracTickets for help on using tickets.