createElement, deleteRow, addRow ie11

prototype para sobre escribir estos metodos.

by jpeter06

HTML

<h3>replace createElement </h3>
<table id="t1" border="1">
    <tr><td>fila1</td></tr>
</table>

JavaScript

if (HTMLTableElement.prototype.deleteRowOLD == undefined){
	HTMLTableElement.prototype.deleteRowOLD=HTMLTableElement.prototype.deleteRow;

	HTMLTableElement.prototype.deleteRow=function(){ 
	  if(arguments.length!=0)this.deleteRowOLD(arguments[0]); 
	  else this.deleteRowOLD(this.rows.length -1);
	};	
}

if (HTMLTableElement.prototype.insertRowOLD == undefined){
	HTMLTableElement.prototype.insertRowOLD=HTMLTableElement.prototype.insertRow;

	HTMLTableElement.prototype.insertRow=function(){ 
	  if(arguments.length!=0)this.insertRowOLD(arguments[0]); 
	  else this.insertRowOLD(this.rows.length);
	};	
}

HTMLDocument.prototype.createElementOLD = HTMLDocument.prototype.createElementOLD  || document.createElement;
//if (HTMLDocument.prototype.createElementOLD == undefined){
	
	HTMLDocument.prototype.createElement=function(){ 
		  if(arguments[0] && arguments[0].indexOf("<")!=-1){
			  return $(arguments[0])[0];
		  }else{
			  if (arguments.lenght!=0 && arguments[0] == "")
				  return document.createTextNode("");
			  else
				  return this.createElementOLD(arguments[0]);
		  }
		};	
//}



var tr=document.createElement('tr');
var td=document.createElement('td');
var textnode = document.createTextNode("Agua"); 
td.appendChild(textnode); 
tr.appendChild(td);
document.getElementById("t1").appendChild(tr); 

/// ----------------
var t = $("<tr><td> texto </td></tr>");
$('#t1').append(t);
////
var aux=document.createElement("<tr><td> texto2 </td></tr>");
$('#t1').append(aux);

var aux2=document.createElement("<tr><td> texto3 </td></tr>");
document.getElementById("t1").insertRow(aux2);