1function newNode(node, text, styles) {
2 node.innerHTML = text;
3 node.className = styles;
4 return node;
5}
6
7var fragment = document.createDocumentFragment(),
8 container = document.getElementById("container");
9
10for(var i = 1; i <= 10; i++) {
11 var tr = document.createElement("tr");
12 var td = newNode(document.createElement("td"), i, "cell");
13 tr.appendChild(td);
14 fragment.appendChild(tr);
15}
16
17container.appendChild(fragment);
18