原来使用的一个js控件,在firefox3.5.5环境下使用时报错:
container.insertAdjacentElement is not a function
原来是firefox没有定义insertAdjacentElement 这个方法,只能自己重定义了,在该控件的脚本中加入以下片段:
HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode){
switch(where){
case "beforeBegin":
this.parentNode.insertBefore(parsedNode,this);
break;
case "afterBegin":
this.insertBefore(parsedNode,this.firstChild);
break;
case "beforeEnd":
this.appendChild(parsedNode);
break;
case "afterEnd":
if(this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);
else
this.parentNode.appendChild(parsedNode);
break;
}
}
报错信息不再出现。