Bug Tracker


Ticket #7081 (closed bug: wontfix)

Opened 4 years ago

Last modified 2 years ago

whitespace-only selectors throw "Syntax error, unrecognized expression"

Reported by: Tomalak Owned by:
Priority: low Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: whitespace expression syntax Cc:
Blocking: Blocked by:


$(" ") throws a syntax error. $("") does not.

The former case can happen when evaluating a HTML Ajax response, for example. When the the response data is passed to jQuery for evaluation it could happens to be a whitespace only string.

Trimming the string before passing it to jQuery fixes this. But realistically, the two variants should yield the same result - an empty jQuery object.

Change History

comment:1 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to wontfix
  • Milestone changed from 1.4.2 to 1.4.3

Why should it be the same result? The first is an expression (albeit an invalid one) the second is no expression at all. I suspect that you may just want to trim the result in your application.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.