diff options
Diffstat (limited to 'src/common.js')
-rw-r--r-- | src/common.js | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/common.js b/src/common.js index 5606706..a3309d9 100644 --- a/src/common.js +++ b/src/common.js @@ -1,22 +1,11 @@ -Object.prototype.clone = Array.prototype.clone = function() //https://stackoverflow.com/questions/12690107/clone-object-without-reference-javascript -{ - if (Object.prototype.toString.call(this) === '[object Array]') - { - var clone = []; - for (var i=0; i<this.length; i++) - clone[i] = this[i].clone(); - return clone; - } - else if (typeof(this)=="object") - { - var clone = {}; - for (var prop in this) - if (this.hasOwnProperty(prop)) - clone[prop] = this[prop].clone(); - return clone; - } - else - return this; +//https://stackoverflow.com/questions/10309650/add-elements-to-the-dom-given-plain-text-html-using-only-pure-javascript-no-jqu +//lets me add elements without fucking up listeners +function appendHtml(el, str) { + var div = document.createElement('div'); + div.innerHTML = str; + while (div.children.length > 0) { + el.appendChild(div.children[0]); + } }
\ No newline at end of file |