是否可以将 $('div:not(:has(video))')
替换为 .not
和 .has
?
最佳答案
如果您阅读文档,您将找到问题的答案:
queries using :has() cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use $( "your-pure-css-selector" ).has( selector/DOMElement ) instead.
https://api.jquery.com/has-selector/
The .not() method will end up providing you with more readable selections than pushing complex selectors or variables into a :not() selector filter. In most cases, it is a better choice.
关于javascript - 用 jQuery 方法替换 not had css 查询选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34403958/