Ever since I stumbled upon AMCSS, I have been utilizing standalone attribute selectors. Recently, I made the switch from Compass to cssnext, only to discover that syntax highlighting appears to be malfunctioning in Atom and other platforms where I tested it.
/* This will be properly highlighted */
h1[foo] { font-weight: bold; }
/* whereas this will not */
[foo] { font-weight: bold; }
It's strange because I couldn't locate any examples of standalone attribute selectors in the specifications, yet they function flawlessly. All the documented instances utilize combined selectors like h1[foo]
.
TL;DR
Are [foo]
and *[foo]
essentially the same and safe to use? Or is it merely a fortunate coincidence that it works?