再次强烈谴责 W3School,写的根本就是错的,而且怎么发邮件也不改过来。
选择器 | 效果 |
---|---|
[attr] | el.attr !== undefined |
[attr=value] | el.attr === 'value' |
[attr^=value] | el.attr.startsWith('value') |
[attr$=value] | el.attr.endsWith('value') |
[attr*=value] | el.attr.includes('value') |
[attr~=value] | el.attr.split(' ').includes('value') |
[attr|=value] | [attr=value]或[attr^=value-] |