Merge pull request #3177 from owncloud/outerHTML_compatibility
Add compatibility function for outerHTML
This commit is contained in:
commit
83db2c83ad
|
@ -134,3 +134,17 @@ if(!String.prototype.trim) {
|
||||||
return this.replace(/^\s+|\s+$/g,'');
|
return this.replace(/^\s+|\s+$/g,'');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
},
|
},
|
||||||
// From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript
|
// From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript
|
||||||
_build: function(o){
|
_build: function(o){
|
||||||
var data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML;
|
var data = this.elem.attr('type') === 'text/template' ? this.elem.html() : outerHTML(this.elem.get(0));
|
||||||
try {
|
try {
|
||||||
return data.replace(/{([^{}]*)}/g,
|
return data.replace(/{([^{}]*)}/g,
|
||||||
function (a, b) {
|
function (a, b) {
|
||||||
|
|
Loading…
Reference in New Issue