querySelector immediate children with :scope
🫧 Open on Bubbles Requirement You are on a web page, using JavaScript, and have a reference to an element node. And you want to select the immediate children of that node using the general syntax used by querySelectorAll , maybe with some extra constraints. What do you do? Failed attempt The CSS syntax for children of a node is using the greater-than character, something like this: #parentNode > , but as soon as you try in JavaScript parentNode.querySelectorAll('> ') you get an error: '> *' is not a vali
评论
?
参与讨论