Side navigation
#13271 closed bug (notabug)
Opened January 19, 2013 05:55PM UTC
Closed January 19, 2013 06:01PM UTC
Inconsistency in $() method in 1.8.3 and 1.9.0
Reported by: | miguel.camba@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I've found this weird behavior when I updated to jquery 1.9.0.
I've generated a string (using a client side template engine, but that doesn't matters) that contains this html:
<li class="photo_fields"> <ul> <li class="col10percent"> <img src="blob:http%3A//localhost%3A3000/3f21fd50-5c77-42a2-b6b7-b04c14f83711"> </li> <li class="col75percent margin15left padding5left"> <div class="progress progress-striped active"> <div class="bar" style="width: 0%;"></div> </div> </li> <li class="col10percent center"> <a href="/photos" data-method="delete" rel="nofollow"> <span class="icon icon_fnc icon_delete"></span> </a> </li> </ul> </li>
I store this string in an variable, let's say, content.
In 1.8.3,
$(content)
works fine. It returns a jQuery object with the proper DOM structure parsed.
In 1.9 the same code raises this error
Error: Syntax error, unrecognized expression: <li class="photo_fields"> <ul> <li class="col10percent"> <img src="blob:http%3A//localhost%3A3000/3f21fd50-5c77-42a2-b6b7-b04c14f83711"> </li> <li class="col75percent margin15left padding5left"> <div class="progress progress-striped active"> <div class="bar" style="width: 0%;"></div> </div> </li> <li class="col10percent center"> <a href="/photos" data-method="delete" rel="nofollow"> <span class="icon icon_fnc icon_delete"></span> </a> </li> </ul> </li>
To be sure that the problem was in jQuery and not in the generated code, I stored this string with localStorage, and tried to parse it in 1.8.3 and 1.9.0. Again, 1.8 works and 1.9 raises this error.
I thought that was because of the blob src in the image tag, but that is not the problem either. I removes the entire img tag from the string, and 1.9 still fails to parse this code.
Am I doing something wrong? The html code seems valid to me.
Attachments (0)
Change History (1)
Changed January 19, 2013 06:01PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring
Be sure to use the jQuery Migrate plugin to check for issues, it should have pointed out this specific case.
http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/