Skip to main content

Bug Tracker

Side navigation

#2640 closed enhancement (invalid)

Opened April 02, 2008 07:37PM UTC

Closed January 31, 2009 05:14PM UTC

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

Attachments (0)
Change History (2)

Changed April 02, 2008 08:04PM UTC by alexpkeaton comment:1

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.

Changed January 31, 2009 05:14PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed