jQuery: The Write Less, Do More JavaScript Library

Ticket #1395 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

$.trim returns exceptions on null value

Reported by: khoker Assigned to: john
Type: enhancement Priority: minor
Milestone: 1.1.4 Component: core
Version: 1.1.3 Keywords: trim
Cc: Needs: Review

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);

Attachments

Change History

Changed 1 year ago by john

  • owner set to john

Changed 1 year ago by john

  • status changed from new to closed
  • resolution set to fixed

Fixed in SVN rev [2422].

Note: See TracTickets for help on using tickets.