Reputation: 43884
I am testing this on jQuery 1.9.1.
I have a pretty standard plugin with an element in the options
object like:
wrapper: '\
<div class="modal_wrapper">\
<div class="modal_outer">\
<div class="modal_inner"> </div>\
</div>\
</div>',
Where the spaces are tabs. When using it with jquery $(options.wrapper)
it breaks with:
uncaught Error: Syntax error, unrecognized expression: <div class="modal_wrapper"> <div class="modal_outer"> <div class="modal_inner"> </div> </div> </div>
However I test this with jQuery 1.8.3 and it works.
Has there been some kind of change? Anyone else getting this problem? I have Google searched but it appears this is one of those things that is not so easy to Google search.
I get it in both Firefox (latest) and Chrome (latest).
Upvotes: 1
Views: 152
Reputation: 298196
It's a bug that was closed two months ago, which is after jQuery 1.9.1 was released.
Update to 1.10.2 and you should be fine.
Upvotes: 2
Reputation: 4656
jQuery 1.9.1
var options = {
wrapper: '\
<div class="modal_wrapper">\
<div class="modal_outer">\
<div class="modal_inner"> </div>\
</div>\
</div>'
}
var html = $.parseHTML(options.wrapper);
console.log($(html));
http://jsfiddle.net/steo/8bTbd/
as of jQuery > 1.9.1 it seems to work without $.parseHTML
Upvotes: 2