Skip to content

Instantly share code, notes, and snippets.

@anton-gorbikov
Last active November 21, 2018 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anton-gorbikov/f3a593310e430d58c0fb4301e3c78a81 to your computer and use it in GitHub Desktop.
Save anton-gorbikov/f3a593310e430d58c0fb4301e3c78a81 to your computer and use it in GitHub Desktop.
(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