因为 IE 不原生支持字符串的 trim 方法,所以,只能再特殊处理。
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
};
}
因为 IE 不原生支持字符串的 trim 方法,所以,只能再特殊处理。
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
};
}
IE6 啊 害人不浅
这个不仅仅是IE6的问题了