Relative Content

Tag Archive for javascriptqueryselectorselectors-api

How to use sibling combinator together with `:scope` in `querySelector`

Let’s say I have an element and I want to select the next matching sibling. Normally, in css I’d be able to write <some selector for this element> ~ <selector for sibling>, but the sibling combinators (~ and +) don’t seem to work when applied inside querySelector with the :scope pseudo-selector.