Use native `String.prototype.trim` in `String.prototype.trim` when available. (kangax)

This commit is contained in:
Juriy Zaytsev 2009-05-07 15:33:13 -04:00 committed by Andrew Dupont
parent 6f6b73cc75
commit cb729625ae
1 changed files with 3 additions and 1 deletions

View File

@ -407,7 +407,9 @@ Object.extend(String.prototype, (function() {
sub: sub,
scan: scan,
truncate: truncate,
strip: strip,
// Firefox 3.5+ supports String.prototype.trim
// (`trim` is ~ 5x faster than `strip` in FF3.5)
strip: String.prototype.trim ? String.prototype.trim : strip,
stripTags: stripTags,
stripScripts: stripScripts,
extractScripts: extractScripts,