Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

[*class|="text"] will also matched textWarning, textInfo, textCenter, etc.


Seems strange to me since the spec says the following:

Represents an element with the att attribute, its value either being exactly "val" or beginning with "val" immediately followed by "-" (U+002D).

it should match text-foo or text but not textFoo


You are correct, that selector would not match textFoo. It is the same as [class^=text-]. The real problem with using these attribute selectors with classes is that they only apply to the first class in the class list. If your element was something like "<p class='content text-foo'>", then it would not be matched by that selector.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: