Implement "attribute not present" CSS selector

RESOLVED DUPLICATE of bug 71647

Status

()

Firefox
General
--
enhancement
RESOLVED DUPLICATE of bug 71647
10 years ago
10 years ago

People

(Reporter: Martin Kutschker, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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
Last Resolved: 10 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 71647
(Reporter)

Comment 2

10 years ago
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.