This means a class beginning with the word "span", such as:
<div class="spanning"></div>
The ^
symbol is taken from regular expressions, wherein this symbol refers to the beginning of a string.
It should be noted that this checks for the beginning of the class attribute, not the beginning of the classname. Which means it will not match said selector:
<div class="globe spanning"></div>
The above element has two classes, the second of which begins with "span" - but since the attribute class
begins with "globe", not with "span", it will not match.
One could use [class*=span]
, which would return all classes containing span, but that would also return other classes, such as wingspan
.
AFAIK, the way to get classes that begin with a string are to use a double selector:
.row [class^="span"], .row [class*=" span"]{}
This will return the class beginning with span, whether at the beginning of the attribute, or in the middle.
(I also recall working in a solution in the homegrown selector engines used by DOMParser).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…