Bug Tracker

Modify

Ticket #3586 (closed enhancement: wontfix)

Opened 5 years ago

Last modified 3 years ago

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
Blocking: Blocked by:

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

comment:1 Changed 5 years ago by flesler

  • Cc dekimsey, flesler added
  • Component changed from core to selector

comment:2 Changed 5 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 5 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 3 years ago by dmethvin

  • Keywords needsreview added

comment:5 Changed 3 years ago by dmethvin

  • Keywords needsreview removed
  • Status changed from new to closed
  • Resolution set to wontfix

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?

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.