Bug Tracker

Modify

Ticket #11433 (closed bug: invalid)

Opened 15 months ago

Last modified 15 months ago

Selecting by class and attribute without tag name

Reported by: andrius@… Owned by:
Priority: low Milestone: None
Component: selector Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

This

$('td.points[data-points=11.5]')

works fine. This doesn't

$('.points[data-points=11.5]')
Error: Syntax error, unrecognized expression: [data-points=11.5]

tried in page and in Chrome console. Why would it be necessary to provide tag name? I believe this is a bug.  http://jsfiddle.net/4D5HL/12/

Change History

comment:1 Changed 15 months ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to selector

From the attribute selector docs:

An attribute value. Can be either an unquoted single word or a quoted string.

You either need to quote it or escape the dot in the attribute value.

Example: [data-points="11.5"] or [data-points=11\.5] The former is preferred.

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.