Side navigation
#13224 closed bug (notabug)
Opened January 16, 2013 01:12AM UTC
Closed January 16, 2013 01:21AM UTC
Last modified January 16, 2013 01:22AM UTC
problem with backslashed multiline string
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Creating element or sub-tree from a string, that writed in a few lines with backslashes at the line ends now gives a syntax error.
jQuery('\\
<div></div>\\
');
> Error: Syntax error, unrecognized expression: <div></div>
but
jQuery('<div></div>');
> [<div></div>]
Attachments (0)
Change History (3)
Changed January 16, 2013 01:20AM UTC by comment:1
_comment0: | Use `$.parseHTML()` for those cases, it is much more lenient about what it parses and also lets you specify whether to process script tags. See the upgrade guide for an example, if you haven't read it already. \ \ http://stage.jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring \ \ \ \ → 1358359538836778 |
---|
Changed January 16, 2013 01:21AM UTC by comment:2
resolution: | → notabug |
---|---|
status: | new → closed |
Changed January 16, 2013 01:22AM UTC by comment:3
Oh also, if you just want to have a literal string with newlines, try
jQuery($.trim('\\ <div></div>\\ '));
Use
$.parseHTML()
for those cases, it is much more lenient about what it parses and also lets you specify whether to process script tags. See the upgrade guide for an example, if you haven't read it already.http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring