blob: d84c38a88e1dafb489e2c2e6eb3b8015c5d7e0c7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script type="text/javascript" charset="utf-8">
var choices = ['foo', 'bar', 'baz', 'baf', 'bop', 'bip'];
function $(id){
return document.getElementById(id);
}
function node(tagName, role){
var el = document.createElement(tagName);
el.setAttribute('role', role);
return el;
}
function randomize(){
var d = $('myData');
d.innerHTML = ''; // clear it out first
for (var i=0; i<3; i++){
var row = node('tr', 'row');
d.appendChild(row);
for (var j=0; j<3; j++){
var cell = node('tr', 'gridcell');
cell.innerHTML = choices[Math.floor(Math.random()*choices.length)]; // populate cell with a random entry from 'choices' array: 'foo', 'bar', 'baz', etc.
row.appendChild(cell);
}
}
}
</script>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div role="grid" tabindex=0 id="grid1">
<div role="rowgroup">
<div role="row">
<span role="columnheader">A</span>
<span role="columnheader">B</span>
<span role="columnheader">C</span>
</div>
</div>
<div role="rowgroup" id="myData"><!-- to be populated by script --></div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that when a table has its DOM changed, all the table method still return the correct data.");
if (window.accessibilityController) {
randomize();
document.getElementById("grid1").focus();
var grid = accessibilityController.focusedElement;
var rows = grid.rowCount;
var columns = grid.columnCount;
randomize();
// this used to crash in debug mode.
shouldBe("rows", "grid.rowCount");
shouldBe("columns", "grid.columnCount");
// clear out the data so that we get the same end results for our layout test.
var d = $('myData');
d.innerHTML = '';
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>