CSSLint / csslint

Automated linting of Cascading Stylesheets
http://csslint.net
Other
4.76k stars 484 forks source link

Example documentation of qualified attribute selectors is wrong. #756

Open Zuppo opened 4 years ago

Zuppo commented 4 years ago

https://github.com/CSSLint/csslint/wiki/Disallow-unqualified-attribute-selectors

The following patterns are considered okay and do not cause warnings:

/* unqualified attribute selector is not key */
.selected [type=text] a {
    color: red;
}

Should read

The following patterns are considered okay and do not cause warnings:

/* unqualified attribute selector is not key */
a.selected [type=text] {
    color: red;
}

I would update this, but could not save edits on the page.

frvge commented 4 years ago

@Zuppo , you probably think that the selected class applies to an a. However, the rule seems to be about the right-most part of the CSS selectors.

In the current example, the a is on the right side, aka the "key" in this text, so then the unqualified attribute selector (implicitly a universal selector) rule doesn't apply.

Based on this, I think the current example is correct. CSS selectors go from right to left.