servo/tests/content/test_img_width_height.html
2014-11-09 15:19:40 +01:00

33 lines
588 B
HTML

<html>
<head>
<title></title>
<script src="harness.js"></script>
</head>
<body>
<img src="test.png"/>
<script>
// Testing get/set of image width/height properties
waitForExplicitFinish();
var img = window.document.getElementsByTagName("img")[0];
function wait_for_img_load(f) {
if (img.width != 0) {
f();
} else {
window.setTimeout(function() { wait_for_img_load(f) }, 1);
}
}
wait_for_img_load(function() {
is(img.width, 500);
is(img.height, 378);
img.width = 200;
img.height = 100;
is(img.width, 200);
is(img.height, 100);
finish();
});
</script>
</body>
</html>