ejs
ejs copied to clipboard
IE8 does not support trim()
Object doesn't support property or method 'trim'
got some example code?
we can swap with a quick regexp
got some example code?
'got some example code?'.trim()
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim
s.replace(/^\s+|\s+$/g,'')
IE8 does not support .map or .reduce either. It sucks, but is still a widely used browser. Would you include code that makes ejs IE8 compatible?
This is biting me now, too. I can't imagine IE is the primary use case, but any chance this can be updated? I'm happy to send the code over in a PR if you're open.
Why don't you just use a shim?
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g,'');
}
}
Why should this be the responsibility of the library author?
This was a compatibility question. If EJS is intended to support IE 8 then it is the responsibility of the library owner. This is even referenced at https://github.com/visionmedia/ejs/issues/89#issuecomment-10784998 .
If it's not intended to support IE 8 then this issue should be closed and I'm happy to use a shim. It's worth asking first.
IE8 is not mentioned anywhere in the readme, and it doesn't work on IE8, so I assume it doesn't support IE8.
国外真幸福。。。2013年就开始说不支持 IE8 了~好吧,换一个。。。