createDocumentFragmentのサンプル

var cdf = document.createDocumentFragment();

var h1 = document.createElement("h1");
h1.appendChild(document.createTextNode('見出し'));

var div = document.createElement("div");
div.appendChild(document.createTextNode('いろいろ入ります'));

var p = document.createElement("p");
p.appendChild(document.createTextNode('サンプルの文章'));

cdf.appendChild(h1);
cdf.appendChild(div);
cdf.appendChild(p);

document.getElementById('r').appendChild(cdf);