Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/cssom/getComputedStyle-visibility-override.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Inherited visibility can be overridden</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#parent {
visibility: hidden;
}
#child {
visibility: visible;
}
</style>
<body>
<div id="parent">
<div id="child">Hello, Dave!</div>
</div>
</body>
<script>
"use strict";
test(() => {
const element = document.querySelector("#parent");
assert_equals(getComputedStyle(element).visibility, "hidden");
}, "Sanity check: Parent is actually visibly hidden");
test(() => {
const element = document.querySelector("#child");
assert_equals(getComputedStyle(element).visibility, "visible");
}, "computed visibility can be visible even if the parent is not");
</script>