Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>An SVG document in an object element follows the object's size</title>
<link rel="author" title="Felipe Erias" href="mailto:felipeerias@igalia.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
object { display: block; width: 200px; height: 100px; }
</style>
<object id="object" data="/images/green.svg" onload="run()"></object>
<script>
function run() {
const object = document.getElementById('object');
const svg = object.getSVGDocument().documentElement;
test(() => {
assert_equals(svg.getBoundingClientRect().width, 200, 'width');
assert_equals(svg.getBoundingClientRect().height, 100, 'height');
}, 'initial size');
test(() => {
object.style.height = '50px';
assert_equals(svg.getBoundingClientRect().height, 50);
}, 'after changing the height');
test(() => {
object.style.width = '100px';
assert_equals(svg.getBoundingClientRect().width, 100);
}, 'after changing the width');
}
</script>