Consider the following example:
selector: [
'.movie[data-id="1"]',
'.item-list a[href^="/reservation"]'
]
We want to ensure .movie[data-id="1"] selector matches 1 element, then we want to select the descending .item-list a[href^="/reservation"] element.
This is different from .movie[data-id="1"] .item-list a[href^="/reservation"]. The latter would match:
<div data-id="1"></div>
<div data-id="1">
<div class="list-item">
<a href="/reservation"></a>
</div>
</div>
The former would not.
An alternative is to allow use of the quantifier expression anywhere in the selector, e.g.
.movie[data-id="1"] {1}[0] .item-list a[href^="/reservation"]
Consider the following example:
We want to ensure
.movie[data-id="1"]selector matches 1 element, then we want to select the descending.item-list a[href^="/reservation"]element.This is different from
.movie[data-id="1"] .item-list a[href^="/reservation"]. The latter would match:The former would not.
An alternative is to allow use of the quantifier expression anywhere in the selector, e.g.