Bug Tracker

Modify

Ticket #1395 (closed enhancement: fixed)

Opened 6 years ago

Last modified 14 months ago

$.trim returns exceptions on null value

Reported by: khoker Owned by: john
Priority: minor Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: trim Cc:
Blocking: Blocked by:

Description

If you attempt $.trim() on a null value, an exception is thrown. Obviously 'null' is a special case, but I would plead that trim(null) shouldn't be an exception. If trim() cannot execute, why not return the input as-is? The same could be said for objects and arrays, to a slightly lesser extent. The end result is forcing the developer to protect every trim() with a try/catch block.

var foo, bar; foo = null; bar = $.trim(foo);

Change History

comment:1 Changed 6 years ago by john

  • Owner set to john

comment:2 Changed 6 years ago by john

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

Fixed in SVN rev [2422].

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.