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-width-scroll.tentative.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>getComputedStyle() round-trips in presence of scrollbars.</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div style="width: 100px; height: 100px; overflow: scroll"></div>
<script>
// NOTE(emilio): This is a .tentative.html because the spec is not clear on
// what the used value of `width` or `height` is, but I think this behavior
// should be uncontroversial.
test(function() {
let e = document.querySelector("div");
let cs = getComputedStyle(e);
let originalWidth = cs.width;
let originalHeight = cs.height;
e.style.width = originalWidth;
e.style.height = originalHeight;
assert_equals(cs.width, originalWidth, "width round-trips");
assert_equals(cs.height, originalHeight, "height round-trips");
}, "getComputedStyle() round-trips in presence of scrollbars")
</script>