diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-04-29 22:35:37 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-04-29 22:35:37 +0200 |
commit | 048569754aec39b0e58232107e8108fed70bf7e8 (patch) | |
tree | 3298671a52c3e7fb09258f78d8ea2b7f6223e1a9 /core/js/compatibility.js | |
parent | 1f194b7bdcbac868525b164b29814d3373b6e818 (diff) | |
download | nextcloud-server-048569754aec39b0e58232107e8108fed70bf7e8.tar.gz nextcloud-server-048569754aec39b0e58232107e8108fed70bf7e8.zip |
Add compatibility function for outerHTML
Diffstat (limited to 'core/js/compatibility.js')
-rw-r--r-- | core/js/compatibility.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/js/compatibility.js b/core/js/compatibility.js index cc37949409d..b690803ca77 100644 --- a/core/js/compatibility.js +++ b/core/js/compatibility.js @@ -133,4 +133,18 @@ if(!String.prototype.trim) { String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g,''); }; -}
\ No newline at end of file +} + +// Older Firefoxes doesn't support outerHTML +// From http://stackoverflow.com/questions/1700870/how-do-i-do-outerhtml-in-firefox#answer-3819589 +function outerHTML(node){ + // In newer browsers use the internal property otherwise build a wrapper. + return node.outerHTML || ( + function(n){ + var div = document.createElement('div'), h; + div.appendChild( n.cloneNode(true) ); + h = div.innerHTML; + div = null; + return h; + })(node); +} |