Bug Tracker

Opened 12 years ago

Closed 11 years ago

#2640 closed enhancement (invalid)

CSS ~= attribute selector

Reported by: alexpkeaton Owned by:
Priority: minor Milestone: 1.2.4
Component: core Version: 1.2.3
Keywords: Selectors Cc:
Blocked by: Blocking:

Description

There should be a ~= selector to select elements with an exact match where attribute values are separated by spaces. For example, suppose I have this HTML fragment:

<div class="button on"></div> <div class="button off"></div>

I would expect to select the "on" element with this:

$("div[class~=button][class~=on]");

The *= selector is similar, but fails in this example because the word "button" contains "on". Alternatively, this works:

$("div[class*=button on]");

But that requires attribute values to be in a specific order, which is not desirable.

Best regards,

Nathan Bryan

Change History (2)

comment:1 Changed 12 years ago by alexpkeaton

This isn't necessary. I found using a selector like ".button.on" will work just fine. I guess I wasn't aware that was possible because IE6 doesn't support that so nobody typically does it that way.

comment:2 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.