IE7,8悬停状态不工作时,使用下划线模板填充html

IE7 & 8 hover state not working when using underscore template to populate html

本文关键字:下划线 填充 html 悬停 状态 工作 IE7      更新时间:2023-09-26

当使用下划线模板引擎时,是否有人有IE悬停状态不工作的问题?IE7和ie8不显示悬停状态。如果我删除_template()方法,直接而不是动态地放入html,它就会正常工作。

这是我的下划线模板设置我还使用backbone来存储将更新模板的数据,使用this.model.toJSON()

var template= _.template( $("#mytemplate").html() );
this.el.html( this.template( this.model.toJSON() ) );

更新:我剥离下来,我已经注意到,即使我不使用下划线,只是使用jquery html()方法,它也不工作。例如:

this.el.html( $("#mytemplate").html() );

是我的模板代码。

<script id="mytemplate" type="text/template">
    <div class="content">
    <a href="http://www.cnn.com">Testing Rollover</a>
    </div>
</script>

还有其他人遇到过这个问题吗

ie8不能很好地使用下划线;这应该修复ie8Var template= ()Template ($("#mytemplate").html())));

你可以在这里引用:https://gist.github.com/39ac06be6abc96c8a69e