Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!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>