In #10001 (comment) @paceaux suggested to introduce a new modifier w that changes the value matching to take word boundaries into account.
Taking the example from that comment, the selector
allows to match all of
<div class="foo-bar">
<div class="foo bar">
<div class="bar foo">
<div class="bar foo--baz">
Though it is not restricted to word prefixes. It could be used in any attribute selector.
So here are some more examples:
Matching suffixes is done via
matches
<div data-values="foo-bar">
<div data-values="foo-bar baz">
<div data-values="foo bar baz">
<div data-values="foobar baz">
Exact word matching (equivalent to [attr~=value]):
matches
<div data-values="foo">
<div data-values="bar foo">
<div data-values="foo bar">
<div data-values="bar foo baz">
but not
<div data-values="foobar">
<div data-values="foo-bar">
<div data-values="barfoo">
<div data-values="bar-foo">
Applied to |=:
matches
<div data-values="foo">
<div data-values="foo-bar">
<div data-values="baz foo">
<div data-values="baz foo-bar">
<div data-values="bar foo baz">
<div data-values="bar foo-baz biz">
but not
<div data-values="foobar">
<div data-values="barfoo">
This can be seen as a counter-proposal to #14289 and covers more use cases than the ones outlined there.
Sebastian
In #10001 (comment) @paceaux suggested to introduce a new modifier
wthat changes the value matching to take word boundaries into account.Taking the example from that comment, the selector
allows to match all of
Though it is not restricted to word prefixes. It could be used in any attribute selector.
So here are some more examples:
Matching suffixes is done via
matches
Exact word matching (equivalent to
[attr~=value]):matches
but not
Applied to
|=:matches
but not
This can be seen as a counter-proposal to #14289 and covers more use cases than the ones outlined there.
Sebastian