parse-has-disallow-nesting-has-inside-has.html (996B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Selectors: The relational pseudo-class (disallow nesting :has() inside :has())</title> 4 <link rel="author" title="Byungwoo Lee" href="mailto:blee@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/selectors-4/#has-pseudo"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/css/support/parsing-testcommon.js"></script> 9 <script> 10 test_invalid_selector('.a:has(.b:has(.c))'); 11 test(() => { 12 // It's not easy to check that these are invalid because :is() and :where() 13 // use forgiving parsing. Check that they never match instead. 14 assert_false(document.documentElement.matches(":has(:is(:has(*)))")); 15 assert_false(document.documentElement.matches(":has(:where(:has(*)))")); 16 assert_true(document.documentElement.matches(":has(:is(:has(*), script))")); 17 assert_true(document.documentElement.matches(":has(:where(:has(*), script))")); 18 }) 19 </script>