If I have this HTML:
<div class="elem">
<div class="child"></div>
</div>
<div class="sibling">
</div>
and the JS
let elem = document.querySelector('.elem');
Using elem.querySelector(":scope ~ div")
does not return anything even though there are div
siblings of elem.
Using elem.querySelector(":scope > div")
returns an element because also there are are div
children of elem.
How could I select the current sibling of elem
having the js object
for elem already selected in a js variable (let elem = document.querySelector('.elem')
)?