Skip to main content

Bug Tracker

Side navigation

#4452 closed bug (fixed)

Opened March 30, 2009 04:18PM UTC

Closed March 09, 2010 02:15PM UTC

Error when calling jQuery.trim

Reported by: buchi Owned by: flesler
Priority: major Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: trim, integer Cc: buchi
Blocked by: Blocking:
Description

Calling:

jQuery.trim(1)

results in:

Error: (text || "").replace is not a function

Source: jquery-1.3.2.js, Line: 1067

IMHO this should return "1"

Attachments (0)
Change History (4)

Changed March 30, 2009 10:54PM UTC by dmethvin comment:1

What should it return on an object, function, regexp, or date object? In some cases it's just best to give the user an error asap.

Changed March 30, 2009 11:08PM UTC by buchi comment:2

Maybe you know it better than I and you're right when passing other objects to jQuery.trim, but in case of an integer it could return the string version of this integer. So the trim-regex won't be needed.

I wanted to discuss this behaviour because I got the mentioned error and at first I had no idea what was wrong.

Other functions also handle integers like strings, e.g.

alert("123") does the same as alert(123)

Changed September 14, 2009 07:11PM UTC by flesler comment:3

cc: → buchi
owner: → flesler

Changed March 09, 2010 02:15PM UTC by john comment:4

milestone: 1.41.4.3
resolution: → fixed
status: newclosed
version: 1.3.21.4.2