mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
34 lines
695 B
HTML
34 lines
695 B
HTML
<html>
|
|
<head>
|
|
<script src="harness.js"></script>
|
|
<style>
|
|
div {
|
|
position: relative;
|
|
top: 100px;
|
|
left: 100px;
|
|
width: 100px;
|
|
height: 100px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div>my div</div>
|
|
<script>
|
|
is_function(DOMRect, "DOMRect");
|
|
|
|
var elems = document.getElementsByTagName('div');
|
|
var rect = elems[0].getBoundingClientRect();
|
|
is_a(rect, DOMRect);
|
|
|
|
geq(rect.top, 100);
|
|
geq(rect.bottom, 200);
|
|
geq(rect.left, 100);
|
|
geq(rect.right, 200);
|
|
|
|
is(rect.width, 100);
|
|
is(rect.height, 100);
|
|
is(rect.width, rect.right - rect.left);
|
|
is(rect.height, rect.bottom - rect.top);
|
|
</script>
|
|
</body>
|
|
</html>
|