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:
- /css/css-anchor-position/anchor-transition-004.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Anchor Positioning Test: getComputedStyle not affecting anchor transition</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body { margin: 0; }
#anchor {
anchor-name: --a;
width: 100px;
height: 100px;
background: teal;
}
#anchored {
position: absolute;
position-anchor: --a;
left: anchor(right, 17px);
top: anchor(top, 17px);
width: 100px;
height: 100px;
background: orange;
transition: left 2s;
}
</style>
<div id="anchor"></div>
<div id="anchored"></div>
<script>
test(() => {
// Force a style update
getComputedStyle(document.body).color;
assert_equals(anchored.offsetLeft, 100);
}, "getComputedStyle should not affect whether an anchor positioned element transitions from display:none");
</script>