Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/selectors/invalidation/negated-has-in-nonsubject-position.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<!doctype html>
<meta charset="utf-8">
<html class="reftest-wait">
<link rel="author" title="David Shin" href="mailto:dshin@mozilla.com">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<style>
.c {
width: 100px;
height: 100px;
background: green;
}
.b:not(.ancestor:has(+ .sibling) .a) .c {
background: red;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div class=ancestor>
<div id=dut class=b>
<div class=c></div>
</div>
</div>
<div class=sibling></div>
<script>
onload = () => {
dut.classList.toggle('a');
dut.getBoundingClientRect(); // Ensure layout flush.
document.documentElement.classList.remove('reftest-wait');
};
</script>