Side navigation
#13351 closed bug (notabug)
Opened January 30, 2013 07:00AM UTC
Closed January 30, 2013 01:36PM UTC
Last modified March 28, 2014 03:52PM UTC
Syntax error, unrecognized expression with whitespace
Reported by: | daniel@danielcarvalho.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If you do an insertAfter, or even an appendTo for that matter, with an HTML string that has whitespace (tabbed whitespace), you get an error: "Syntax error, unrecognized expression".
This can be remedied by executing jQuery.trim onto the HTML string, but this never used to break in earlier versions of jQuery like v1.7.2. Only the new release v1.9.0. You shouldn't need to do jQuery trim. So older code breaks with zero changes.
Example: http://jsfiddle.net/6XTk2/
Attachments (0)
Change History (6)
Changed January 30, 2013 07:06AM UTC by comment:1
Changed January 30, 2013 07:11AM UTC by comment:2
Sorry, another update. But this is even worse, it's not even tabbed whitespace, it's ANY whitespace.
A even more powerful example -> http://jsfiddle.net/6XTk2/2/
Changed January 30, 2013 07:19AM UTC by comment:3
The last link should be http://jsfiddle.net/6XTk2/3/
Changed January 30, 2013 01:36PM UTC by comment:4
resolution: | → notabug |
---|---|
status: | new → closed |
Yes, that's documented in the upgrade guide. By far, the most common situation where whitespace may appear is when processing an HTML template. For those cases, use $.parseHTML
to specify (for both your sake and the sake of anyone else reading the code) whether you intend for scripts to be run in the incoming HTML.
Changed March 28, 2014 03:52PM UTC by comment:6
Replying to [comment:4 dmethvin]:
Yes, that's documented in the upgrade guide. By far, the most common situation where whitespace may appear is when processing an HTML template. For those cases, use $.parseHTML
to specify (for both your sake and the sake of anyone else reading the code) whether you intend for scripts to be run in the incoming HTML.
Why is this documented in the changelogs but not in the normal documentation?
Please see an even more powerful and simple example -> http://jsfiddle.net/6XTk2/2/
It just has one simple tab of whitespace.
Replying to [ticket:13351 daniel@…]: