chromium/third_party/blink/web_tests/accessibility/table-cells.html

<html>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();
</script>
<body>
    
    
    <table id="testTable" align="center" border="1" cellpadding="5" cellspacing="0">
        <caption> Example #1: Nested Stubs </caption>
        <tr>
            <th class="center" colspan="2" rowspan="2">Ruritanian<br> Population
                <br> Survey</th>
            <th class="center" rowspan="2">All<br> Genders</th>
            
            <th class="center" colspan="2">By Gender</th>
            </tr>
        <tr>
            <th class="center">Males</th>
            <th class="center">Females</th>
            </tr>
        <tr>
            
            <th align="left" rowspan="2">All Regions</th>
            <th>North</th>
            <td align="right">3333</td>
            <td align="right">1111</td>
            <td align="right">2222</td>
            </tr>
        
        <tr>
            <th>South</th>
            <td align="right">3333</td>
            <td align="right">1111</td>
            <td align="right">2222</td>
            </tr>
        <tr>
            <th>South</th>
            <td align="right">3333</td>
            <td align="right" colspan="2">1111</td>
            <td align="right">2222</td>
            </tr>
        <tr>
            <th>South</th>
            <td align="right" colspan="2">3333</td>
            <td align="right">1111</td>
            <td align="right">2222</td>
            </tr>
    </table>
    
    <div id="result"></div>
    
    <script>
        if (window.accessibilityController) {
            var result = document.getElementById("result");

            var table = accessibilityController.accessibleElementById("testTable");
            
            result.innerText += "------------------------\n"; 
            result.innerText += "[0,0]\n" + table.cellForColumnAndRow(0,0).allAttributes() + "\n";
            result.innerText += "------------------------\n"; 
            result.innerText += "[3,1]\n" + table.cellForColumnAndRow(3,1).allAttributes() + "\n"; 
            result.innerText += "------------------------\n"; 
            result.innerText += "[1,1]\n" + table.cellForColumnAndRow(1,1).allAttributes() + "\n"; 
            result.innerText += "------------------------\n"; 
            result.innerText += "[2,2]\n" + table.cellForColumnAndRow(2,2).allAttributes() + "\n"; 
            result.innerText += "------------------------\n"; 
            result.innerText += "[3,5]\n" + table.cellForColumnAndRow(3,5).allAttributes() + "\n"; 
            result.innerText += "------------------------\n"; 
            result.innerText += "[100,0]\n";
            outOfRangeCell = table.cellForColumnAndRow(100,0);
            result.innerText += outOfRangeCell != null ? outOfRangeCell.allAttributes() : "";
            result.innerText += "\n";
            result.innerText += "------------------------\n";
            outOfRangeCell = table.cellForColumnAndRow(0,100);
            result.innerText += "[0,100]\n";
            result.innerText += outOfRangeCell != null ? outOfRangeCell.allAttributes() : "";
            result.innerText += "\n";
        }
    </script>
</body>
</html>