diff options
Diffstat (limited to 'testing/web-platform/tests/css/cssom-view/offsetTop-offsetLeft-nested-offsetParents.html')
-rw-r--r-- | testing/web-platform/tests/css/cssom-view/offsetTop-offsetLeft-nested-offsetParents.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom-view/offsetTop-offsetLeft-nested-offsetParents.html b/testing/web-platform/tests/css/cssom-view/offsetTop-offsetLeft-nested-offsetParents.html new file mode 100644 index 0000000000..e9446708d3 --- /dev/null +++ b/testing/web-platform/tests/css/cssom-view/offsetTop-offsetLeft-nested-offsetParents.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://drafts.csswg.org/cssom-view-1/#dom-htmlelement-offsettop"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<style> +.square { + width: 10px; + height: 10px; + background-color: red; +} +#one { + position: absolute; + top: 10px; + left: 10px; +} +#two { + position: absolute; + top: 50px; + left: 50px; +} +span.square { + display: inline-block; +} +</style> + +<div id=one class=square> + <div id=two class=square> + <div class=square></div> + <span class=square></span><span id=target></span> + </div> +</div> + +<script> +test(() => { + assert_equals(target.offsetTop, 10, 'target.offsetTop'); + assert_equals(target.offsetLeft, 10, 'target.offsetLeft'); +}, 'Verifies that offsetTop and offsetLeft only go up one offsetParent when there are multiple nested offsetParents.'); +</script> |