This div is element x. It has align, style, and onclick attributes.

It will be cloned and added to the document fragment. Then the fragment will be appended to the page. In the end, a copy of this div will appear at the bottom of the page.

W3C DOM tests - document fragments

This page tests document fragments.

Test scripts

createDocumentFragment()

var test = document.createDocumentFragment();
test.appendChild(x.cloneNode(true));
document.body.appendChild(test);
var test = document.createDocumentFragment();
test.appendChild(x);
document.body.appendChild(test);