- From: valentin <notifications@github.com>
- Date: Sun, 22 May 2022 23:56:23 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 23 May 2022 06:56:35 UTC
Well actually, I didn't find any subject or topic asking for a `.matches` with the possibility to specify a `:scope`. It seems that the `:scope` selector is not used frequently, after a few searches on github, stackoverflow or google. A workaround exists: ```ts const childNode = parentNode.querySelector(':scope > *'); childNode.matches('* > :scope'); // true => works ! ``` However, it has 2 drawbacks: - it's not easy to algorithmically convert a `querySelector` into a `matches` because we have to parse the css selector and revert it. - and (only from my point of view) it could be confusing for new incomers: the selector for `querySelector` and `matches` could be the same and match in most cases, but it won't for `:scope` But as you said, it requires some community approval, requirement and/or interest. Maybe I'm the only one to find interest in it. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1081#issuecomment-1134256287 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1081/1134256287@github.com>
Received on Monday, 23 May 2022 06:56:35 UTC