Skip to main content

Bug Tracker

Side navigation

#13781 closed bug (notabug)

Opened April 16, 2013 07:18AM UTC

Closed April 16, 2013 09:05AM UTC

Last modified April 21, 2013 12:31PM UTC

Problems about `text` method of jQuery

Reported by: khalilzhang@126.com 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

Attachments (0)
Change History (2)

Changed April 16, 2013 09:05AM UTC by gibson042 comment:1

component: unfiledmanipulation
resolution: → notabug
status: newclosed

It looks like you have confused jQuery.text with the .text ''[http://api.jquery.com/text/ instance method]'': http://jsfiddle.net/hZ9Hy/1/

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

Changed April 21, 2013 12:31PM UTC by KhalilCheung <khalilcheung@126.com> comment:2

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