Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Test <svg:image>'s sizing with css size as auto, with dynamic image change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg height="0">
<image width="128" height="128" xlink:href="/images/green-256x256.png" style="width:auto; height:auto"/>
</svg>
<script>
async_test(function(t) {
var image = document.querySelector('image');
window.onload = t.step_func(function() {
var rectBBox = image.getBBox();
assert_equals(rectBBox.width, 256);
assert_equals(rectBBox.height, 256);
image.setAttributeNS("http://www.w3.org/1999/xlink","href","data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'></svg>");
image.onload = t.step_func_done(function() {
var rectBBox = image.getBBox();
assert_equals(rectBBox.width, 64);
assert_equals(rectBBox.height, 64);
});
});
});
</script>