diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-anchor-position/anchor-name-in-shadow.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-anchor-position/anchor-name-in-shadow.html')
-rw-r--r-- | testing/web-platform/tests/css/css-anchor-position/anchor-name-in-shadow.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/anchor-name-in-shadow.html b/testing/web-platform/tests/css/css-anchor-position/anchor-name-in-shadow.html new file mode 100644 index 0000000000..7e505ed592 --- /dev/null +++ b/testing/web-platform/tests/css/css-anchor-position/anchor-name-in-shadow.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<title>anchor-name is a tree scoped reference</title> +<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#target-anchor-element"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + body { margin-top: 0; } + #anchor { + anchor-name: --anchor; + } + #filler { + height: 100px; + } + #anchored { + position: absolute; + top: anchor(--anchor top); + } +</style> +<div id="host"></div> +<div id="filler"></div> +<div id="anchor"></div> +<div id="anchored"></div> +<script> + const host_root = host.attachShadow({mode:"open"}); + host_root.innerHTML = ` + <style> + div { anchor-name: --anchor; } + </style> + <div></div> + `; + + test(() => { + assert_equals(anchored.offsetTop, 100, "#anchored is positioned against #anchor"); + }, "anchor-name should not leak out of a shadow tree"); +</script> + +<div id="anchor_host" style="anchor-name: --anchor-host"></div> +<script> + const anchor_host_root = anchor_host.attachShadow({mode:"open"}); + anchor_host_root.innerHTML = ` + <style> + div { + position: absolute; + left: anchor(--anchor-host left, 37px); + } + </style> + <div id="anchored"></div> + `; + + test(() => { + assert_equals(anchor_host_root.querySelector("#anchored").offsetLeft, 37, "#anchored is positioned using fallback"); + }, "anchor() in shadow tree should not match host anchor-name"); +</script> |