Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13781 closed bug (notabug)

Problems about `text` method of jQuery

Reported by: khalilzhang@… Owned by:
Priority: undecided Milestone: None
Component: manipulation Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:

Description

hi,

I have a question about text method of jQuery, I know that it's a shortcut of Sizze.getText and it only accept array or element object as its argument. But I encounter one problem about it, if I pass a class or other string selector to it, it will cause an 'Uncaught RangeError' that exceeds the maximum call stack size.

I don't know whether is a bug or something else, but I think if I input the wrong arguments and at least it won't let the browser(such as Firefox) stop working.

Here is test case about it on jsfiddle.net.

thanks,

Khalil

Change History (2)

comment:1 Changed 6 years ago by gibson042

Component: unfiledmanipulation
Resolution: notabug
Status: newclosed

It looks like you have confused jQuery.text with the .text instance method: http://jsfiddle.net/hZ9Hy/1/

Regardless, we don't generally make a point of adding code to support invalid arguments.

comment:2 Changed 6 years ago by KhalilCheung <khalilcheung@…>

No, I'm not confused it with the .text instance method. I have emphasised that I just had a doubt about the jQuery.text method in the ticket.

Regardless, I have got your idea. However, I also think jQuery should avoid the misoperation of users, such as that.

thanks

Note: See TracTickets for help on using tickets.