Bug Tracker

Modify

Ticket #5643 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

$.trim() in jQuery 1.4a1 strips out embedded newlines

Reported by: JeremyRuston Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.4a1
Keywords: Cc:
Blocking: Blocked by:

Description

I think the regexp for $.trim() has been broken. It seems to remove all white space, not just that at the start and end.

The old code was:

return (text || "").replace( /^\s+|\s+$/g, "" );

The equivalent regexp in the new code is:

rtrim = /(\s|\u00A0)+|(\s|\u00A0)+$/g,

It looks like we've lost a caret

Change History

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to fixed

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.