1 <script type="ctrip-template-x" id="ctrip-page-index"> 2 <article class="wrap"> 3 <nav class="carbar"></nav> 4 <section class="p10"> 5 <ul class="list_st_border carlist"> 6 <li data-hash="pickon">xxx<i class="arr_r"></i></li> 7 <li data-hash="seeoff">xxx<i class="arr_r"></i></li> 8 <li data-hash="rent">xxx<i class="arr_r"></i></li> 9 <li data-hash="hotline">小小小<i class="arr_r"></i></li> 10 </ul> 11 </section> 12 </article> 13 </script>
IE9 用jQuery插入页面的时候,报错UncaughtError:Syntax error, unrecognized expression:
<article class="wrap"> 3 <nav class="carbar"></nav> <section class="p10">
错误,是来自Sizzle.error =function( msg ){thrownewError("Syntax error, unrecognized expression: "+ msg );
报错,查找到原因是这样 http://stage.jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring
解决办法如下:
data.context = $($.parseHTML(tmpl("template-upload", file))[1])
或者可以
https://github.com/jquery/jquery-migrate/
专门解决这个BUG的
参考 http://stackoverflow.com/questions/14986089/railsjquery-syntax-error-unrecognized-expression