Skip to main content

Bug Tracker

Side navigation

#6216 closed enhancement (duplicate)

Opened March 04, 2010 08:43AM UTC

Closed March 09, 2010 02:07PM UTC

[Patch] Drop-in replacement for jQuery's trim() function

Reported by: mgruner Owned by:
Priority: Milestone: 1.4.3
Component: misc Version: 1.4.2
Keywords: patch, trim, speed, performance, optimization Cc: marc.nilius@otrs.com
Blocked by: Blocking:
Description

Inspired by http://blog.stevenlevithan.com/archives/faster-trim-javascript, I developed a trim() function that is just a little slower than the current, regexp-replacement based solution in jQuery 1.4.2 for very short strings (< 50 characters). It is, however, MUCH faster for longer and very long strings. Depending on the browser, the speed improvement compared to the current implementation can be several orders of magnitude. Please see the attached patch.

Best regards and wishes for the success of jQuery,

Martin Gruner

Attachments (1)
Change History (1)

Changed March 09, 2010 02:07PM UTC by john comment:1

resolution: → duplicate
status: newclosed

Duplicate of #2279.