Skip to content

Instantly share code, notes, and snippets.

@anton-gorbikov
Last active Nov 21, 2018
Embed
What would you like to do?
(function() {
let template = document.getElementById('testTemplate');
function removeNode(node) {
node.parentNode.removeChild(node);
}
for (let i = 0; i < 1000; ++i) {
let clone = document.importNode(template.content, true);
clone.querySelector('.test-class1').innerHTML = 'Firts Column_' + i;
clone.querySelector('.test-class2').innerHTML = 'Second Column_' + i;
clone.querySelector('.test-class3').innerHTML = 'Third Column_' + i;
document.getElementById('parent').appendChild(clone);
}
let slice = Array.prototype.slice.call;
slice(document.getElementsByClassName('test-class1'), 0).forEach(removeNode);
slice(document.getElementsByClassName('test-class2'), 0).forEach(removeNode);
slice(document.getElementsByClassName('test-class3'), 0).forEach(removeNode);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment