Skip to main content

Bug Tracker

Side navigation

#1395 closed enhancement (fixed)

Opened July 13, 2007 05:38PM UTC

Closed July 20, 2007 07:44PM UTC

Last modified March 15, 2012 04:15PM UTC

$.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:
Blocked by: Blocking:

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 (0)
Change History (2)

Changed July 20, 2007 03:32PM UTC by john comment:1

owner: → john

Changed July 20, 2007 07:44PM UTC by john comment:2

resolution: → fixed
status: newclosed

Fixed in SVN rev [2422].