I want to store multiple HTMLCollection in an array but I don't want them to be dynamic.
var history = [];
var mysvg = document.getElementsByTagName("svg")[0];
this.saveToHistory = function(){
history.push(mysvg);
}
For now, in my array history
, the mysvg
is a dynamic HTMLcollection. history[0]
will be the same than history[1]
even if when i called saveToHistory()
history[0]
was different from history[1]
I think making a copy of mysvg
before pushing it in history
is the way to solve this... but how can I do this?