<!DOCTYPE>
<html>
<body onload="test()">
<select id="myList" size="10" multiple></select>
<script>
function populateList()
{
    var myList = document.getElementById("myList");
    var item;

    for (var ii = 0; ii < 20; ii++) {
        item = document.createElement("option");
        item.value = ii;
        item.appendChild(document.createTextNode("Item #" + ii));
        myList.appendChild(item);
    }
}

function clearList()
{
    var myList = document.getElementById("myList");
    var items = myList.getElementsByTagName("option");

    for (var ii = items.length-1; ii >= 0; ii--) {
        myList.removeChild(items[ii]);
    }
}

function test()
{
    if (window.testRunner)
        testRunner.waitUntilDone();

    populateList();
    document.getElementById("myList").selectedIndex = 19;
    document.body.offsetWidth; // Force a layout.
    clearList();
    document.body.offsetWidth; // Force a layout.
    populateList();

    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</body>
</html>
