Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/rendering/the-details-element/details-pseudo-elements-006.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<title>::details-content pseudo element supports :hover</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<style>
html, body { margin: 0; padding: 0; }
details { width: 200px; height: 100px; }
summary { height: 30px; }
body { color: black; background: white; }
details::details-content:hover { color: green }
</style>
<details open>
<summary>summary</summary>
<div id="inside">contents</div>
</details>
<script>
promise_test(async () => {
let cs = getComputedStyle(document.getElementById("inside"));
await new test_driver.Actions().pointerMove(300, 35).send();
assert_equals(cs.color, "rgb(0, 0, 0)", "no :hover styles when pointer is outside");
await new test_driver.Actions().pointerMove(100, 35).send();
assert_equals(cs.color, "rgb(0, 128, 0)", ":hover styles when pointer is inside");
}, "::details-content matches :hover when mouse pointer is over it");
</script>