2 <script src=
"../../../resources/testharness.js"></script>
3 <script src=
"../../../resources/testharnessreport.js"></script>
4 <div id=
"target"> abc
</div>
7 var target
= document
.getElementById('target').firstChild
;
8 function clientRectLeftOfNodeOffsetAt(offset
) {
9 var range
= document
.createRange();
10 range
.setStart(target
, offset
);
11 var rects
= range
.getClientRects();
12 return rects
.length
? rects
[0].left
: 'no rects';
15 assert_equals(clientRectLeftOfNodeOffsetAt(0), clientRectLeftOfNodeOffsetAt(3), '0');
16 assert_equals(clientRectLeftOfNodeOffsetAt(1), clientRectLeftOfNodeOffsetAt(3), '1');
17 assert_equals(clientRectLeftOfNodeOffsetAt(2), clientRectLeftOfNodeOffsetAt(3), '2');
18 }, 'leading whitespaces');
21 assert_greater_than(clientRectLeftOfNodeOffsetAt(6), clientRectLeftOfNodeOffsetAt(5), '6');
22 assert_equals(clientRectLeftOfNodeOffsetAt(7), clientRectLeftOfNodeOffsetAt(6), '7');
23 assert_equals(clientRectLeftOfNodeOffsetAt(8), clientRectLeftOfNodeOffsetAt(6), '8');
24 }, 'trailing whitespaces');