IE9 jQuery 1.9.1 报 Syntax error,unrecognized expression 错误



     


IE9 用jQuery插入页面的时候,报错UncaughtError:Syntax error, unrecognized expression:


错误,是来自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