Closed Bug 426318 Opened 16 years ago Closed 16 years ago

Implement "attribute not present" CSS selector

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 71647

People

(Reporter: Martin.T.Kutschker, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12

As is acknowledged in section "6.3.4. Default attribute values in DTDs" of the CSS3 Selectors specification default attributes are a problem. And so are any missing attributes in general (eg when looking for images without alt-attribute).

So I propose a selector that matches when an attribute is missing:

[!attribute]

So you can finally find images with missing alt attributes easily :-)

Reproducible: Always




CSS3 Selectors (my addition!!!)

6. Simple selectors

6.3. Attribute selectors

6.3.1. Attribute presence and values selectors

[!att]
Represents an element without the att attribute.

Examples:

The following attribute selector represents an img element that is lacking an alt attribute:

img[!alt]
These things should be proposed to the CSS working group not us, but as it happens what you are requesting already exists in CSS3 and was implemented in Mozilla 7 years ago.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Funny thing I missed the :not() selector. But when it comes to actually using CSS I think that it's more obvious to have a special negative as well.
You need to log in before you can comment on or make changes to this bug.