From cb729625ae2d5eff54a162e9a9c2c4f78ef83dd2 Mon Sep 17 00:00:00 2001 From: Juriy Zaytsev Date: Thu, 7 May 2009 15:33:13 -0400 Subject: [PATCH] Use native `String.prototype.trim` in `String.prototype.trim` when available. (kangax) --- src/lang/string.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lang/string.js b/src/lang/string.js index 6d715c1..2798bcc 100644 --- a/src/lang/string.js +++ b/src/lang/string.js @@ -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,