Bug Tracker

Opened 7 years ago

Closed 7 years ago

#13476 closed bug (duplicate)

Sizzle fails due to untrimmed whitespace

Reported by: NiX Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Code below will fail due to white space in the beginning of the string:

$("\n<div/>");

Same goes for \t and \r. That's all I tried so far.

My original code had a multiline string with HTML code but the example above is essentially the same thing.

It looks like this bug was introduced in 1.9.0

I tracked it down to the regex in rquickExpr

In 1.8.3 it was

rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,

and in 1.9.0 it became

rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #13223.
The jQuery Migrate plugin should have warned you about this, were you using it?

https://github.com/jquery/jquery-migrate/blob/master/warnings.md#jqmigrate-html-html-strings-must-start-with--character

Note: See TracTickets for help on using tickets.