Ticket #1395 (closed enhancement: fixed)
$.trim returns exceptions on null value
|Reported by:||khoker||Owned by:||john|
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);