Bug Tracker

Modify

Ticket #7658 (closed bug: duplicate)

Opened 2 years ago

Last modified 2 years ago

after() throws nonsense error if called on an empty selection

Reported by: matteosistisette Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocking: Blocked by:

Description

Consider this expression:

$("#nonexistent").after(",");

If there is at least one element with id="nonexistent", then this expression adds a comma after it.

If there is no such element, it throws the following error: "Error: uncaught exception: Syntax error, unrecognized expression: ,"

I'm not sure whether it should throw any error at all (i think it shouldn't, should just do nothing), but _certainly_ this is not the error that should be thrown. The expression "," is perfectly valid, as it is an html string; the proof is that when the selection is not empty, it works.

Change History

comment:1 Changed 2 years ago by snover

  • Status changed from new to closed
  • Resolution set to duplicate

comment:2 Changed 2 years ago by snover

Duplicate of #7623.

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

View

Add a comment

Modify Ticket

Action
as closed
Author


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

 
Note: See TracTickets for help on using tickets.