Opened 13 years ago
Closed 13 years ago
#6216 closed enhancement (duplicate)
[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: | [email protected]… |
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)
Note: See
TracTickets for help on using
tickets.
Optimized trim function for jQuery