Internet Explorer无法正确呈现JavaScript [英] Internet Explorer not rendering javascript properly

查看:116
本文介绍了Internet Explorer无法正确呈现JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个小问题,但无法弄清楚它为什么会发生。在Internet Explorer 9及更高版本上,以下代码呈现为应如下所示:

I got ran into a small problem but can not figure out why it is happening. On internet explorer 9 and above the following code is rendering as it should be as given below

<div class="nav-bar">

但在Internet Explorer 8中显示此

but in internet explorer 8 its display this

<DIV class=nav-bar jQuery18306474608844609571="10">

请帮助和谢谢

推荐答案

这是预期的行为。当你例如想要在节点上存储数据时jQuery如何识别不同的DOM注释:

This is expected behavior. Its how jQuery identify different DOM-notes when you for instance wants to store data on a node:

 $(node).data('a', true);

不是在节点上存储数据标识符,而是将其设置为IE8中的属性以避免出现问题垃圾收集器。

Instead of storing the data identifier on the node it sets it as an attribute in IE8 to avoid trouble with the Garbage Collector.

在现代浏览器中,jQuery直接在节点上存储标识符。

In modern browsers jQuery stores the identifier directly on the node.

查看< 函数internalData下的一个href =http://code.jquery.com/jquery-latest.js =nofollow>源代码(elem,name,data,pvt / *仅供内部使用* /){

Look in the source code under function internalData( elem, name, data, pvt /* Internal Use Only */ ){

这篇关于Internet Explorer无法正确呈现JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆