In testing, no:
Code:
window.onload = function(){
var el = document.createElement('div');
el.appendChild(document.createTextNode('Hi'));
for (var i = 10; i > 0; --i)
document.body.appendChild(el);
};
will append only one node to the body. However, if you clone the node:
Code:
window.onload = function(){
var el = document.createElement('div');
el.appendChild(document.createTextNode('Hi'));
for (var i = 10; i > 0; --i)
document.body.appendChild(el.cloneNode(true));
};
That works.
If you do this though, be careful. If you set an id for the node or anything that later may need to be unique for further processing, there will be problems if and when that unique feature is attempted to be used in that processing.
Bookmarks