Bug Tracker

Opened 11 years ago

Closed 10 years ago

#4452 closed bug (fixed)

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"

Change History (4)

comment:1 Changed 11 years ago by dmethvin

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.

comment:2 Changed 11 years ago by buchi

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)

comment:3 Changed 10 years ago by flesler

Cc: buchi added
Owner: set to flesler

comment:4 Changed 10 years ago by john

Milestone: 1.41.4.3
Resolution: fixed
Status: newclosed
Version: 1.3.21.4.2
Note: See TracTickets for help on using tickets.