Modify ↓
Ticket #6868 (closed bug: fixed)
$.trim very expensive on long strings
| Reported by: | kemayo | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.3 |
| Component: | unfiled | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I ran $.trim on a ~17kB string, and it caused my browser to ask me if I wanted to stop an unresponsive script.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

<html> <head> <script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> <script> $(document).ready(function() { var txt = " "; for (var i =0; i <1700;i++) txt+="1234567890"; $.trim(txt); txt += " "; $(".inner").text(txt); alert('done'); }); </script> </head> <body> <div class="inner"> Hello </div> </body> </html>works fine