~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/layout/html/tests/table/other/move_row.html

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<script>
 
3
function moveRow(from, to)
 
4
{
 
5
        if (from == -1 && to == -1)
 
6
        {
 
7
                var fromE = document.getElementsByTagName("INPUT")[0];
 
8
                from = parseInt(fromE.value);
 
9
                var toE = document.getElementsByTagName("INPUT")[1];
 
10
                to = parseInt(toE.value);
 
11
        }
 
12
        var row = document.getElementsByTagName("TR")[from];
 
13
        row.rowIndex = to;
 
14
}
 
15
function runTests()
 
16
{
 
17
        // Test fails if final ordering differs from initial ordering
 
18
        //
 
19
        // Starting with order 0,1,2,3,4,5 shift through the rows and 
 
20
        // end up back where we started.  
 
21
        moveRow(0, 5);
 
22
        moveRow(1, 4);
 
23
        moveRow(2, 3);
 
24
        moveRow(3, 2);
 
25
        moveRow(4, 1);
 
26
        moveRow(5, 0);
 
27
 
 
28
        // Throw 2 out-of-bounds tests at the end and still get back to the starting point.
 
29
        moveRow(5, -1);
 
30
        moveRow(0, 6);
 
31
}
 
32
function delay()
 
33
{
 
34
        setTimeout("runTests()", 9);
 
35
}
 
36
</script>
 
37
<body bgcolor=white onload="delay()">
 
38
<table>
 
39
<tr><td>Row 0</td></tr>
 
40
<tr><td>Row 1</td></tr>
 
41
<tr><td>Row 2</td></tr>
 
42
<tr><td>Row 3</td></tr>
 
43
<tr><td>Row 4</td></tr>
 
44
<tr><td>Row 5</td></tr>
 
45
</table>
 
46
<input type=text name=from value=2 size=1>
 
47
<input type=text name=to value=4 size=1>
 
48
<input type=button name=go value=go onclick="moveRow(-1,-1);">
 
49
</body>
 
50
</html>