blob: 4ea1c67811303b5fbe904c871acf7a1c8bf447f9 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body style="font-family: ahem; -webkit-font-smoothing: none;">
<style>
div.table { display: table; }
div.section { display: table-row-group; }
div.test { background-color: green; width: 50px; height: 50px; }
</style>
<div class="table" id="table-1">
<div class="section" id="tbody-1">
</div>
<div class="section" id="tbody-2">
</div>
</div>
<script>
function createDiv()
{
var divElement = document.createElement("div");
divElement.setAttribute("class", "test");
return divElement;
}
function insertDiv(tableID, beforeID)
{
var table = document.getElementById(tableID);
var before = document.getElementById(beforeID);
table.insertBefore(createDiv(), before);
}
document.body.offsetTop;
insertDiv("table-1", "tbody-2");
</script>
</body>
</html>