4 <title>Document::nodesFromRect : basic text nodes and links test - bug
47795</title>
5 <style type=
"text/css"> @import
"resources/nodesFromRect.css"; </style>
6 <script src=
"../../../resources/js-test.js"></script>
7 <script src=
"resources/nodesFromRect.js"></script>
8 <script type=
"application/javascript">
13 // Set up shortcut access to elements
14 e['html'] = document.getElementsByTagName(
"html")[
0];
15 ['p1', 'a1', 'a2', 'a3', 'body'].forEach(function(a) {
16 e[a] = document.getElementById(a);
19 window.scrollTo(
0,
0);
21 // Area with links and text nodes:
22 var centerA1 = getCenterFor(e.a1);
23 var centerA2 = getCenterFor(e.a2);
24 var centerA3 = getCenterFor(e.a3);
25 var topP1 = getTopFor(e.p1);
26 var topA1 = getTopFor(e.a1);
27 var centerText = { x : (centerA2.x + centerA1.x) /
2, y : centerA1.y }; //text node between a1 and a2
29 check(centerA1.x, centerA1.y,
0,
0,
0,
0, [e.a1.firstChild]);
30 check(centerA1.x, centerA1.y, topA1.y - topP1.y,
0,
0,
0, [e.a1.firstChild, e.a1, e.p1]);
32 check(centerA1.x, centerA1.y,
0,
0, centerA3.y - centerA1.y,
0, [e.a3.firstChild, e.a3, e.p1, e.a1.firstChild, e.a1]);
33 check(centerA1.x, centerA1.y,
0, centerText.x - centerA1.x,
0,
0, [e.p1.childNodes[
2], e.a1.firstChild, e.a1, e.p1]);
34 check(centerA1.x, centerA1.y,
0, centerA2.x - centerA1.x,
0,
0, [e.a2.firstChild, e.a2, e.p1.childNodes[
2], e.a1.firstChild, e.a1, e.p1]);
35 check(centerA1.x, centerA1.y,
0, centerA2.x - centerA1.x, centerA3.y - centerA1.y,
0, [e.a3.firstChild, e.a3, e.p1, e.a2.firstChild, e.a2, e.p1.childNodes[
2], e.a1.firstChild, e.a1]);
38 window.onload = runTest;
43 <a href=
"#" id=
"a1">A
</a> /
<a href=
"#" id=
"a2">B
</a><br/><a href=
"#" id=
"a3">C
</a>
46 <span id=
"console"></span>