A previous stackoverflow question had this as part of its solution:
$.text([this])
I’ve never seen that syntax before. The complete statement was:
return $.text([this]).indexOf(myInput) == 0
So I’m thinking $(this).text() couldn’t be used.
Q: Where is $.text([this]) mentioned in any of the documentation?
It’s just more efficient to use
$.text([this])when you don’t need the jQuery object created by$(this). They do the same thing, just no need to create the jQuery object along the way.It’s not AFAIK, you’re calling
jQuery.textwhich (in the current version) is just an alias forSizzle.getText.