jQuery .clone().html()在IE Bug中 [英] jQuery .clone() .html() in IE Bug

查看:109
本文介绍了jQuery .clone().html()在IE Bug中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery 1.6.2中似乎还存在一个bug,它存在.clone()和.html()的问题。我创建了一个小提琴: http://jsfiddle.net/Vxyu3/12/ 应该有助于解释错误。如果您一个接一个地点击两个链接,那么在Firefox中,内容会来回翻转而不会出现任何问题。然而,在IE浏览器(特别是IE7)中,如果转到提琴然后点击显示动态内容,然后选择显示克隆,然后选择显示动态内容,然后选择显示克隆,克隆内容将不再可见。实际上它甚至没有被注入到DOM中。这就像它消失了,或者一路上被抹去了......有没有人遇到过这个bug,我会从哪里开始解决这个问题。

There seems to be a bug still present in jQuery 1.6.2 that has an issue with .clone() and .html(). I created a fiddle: http://jsfiddle.net/Vxyu3/12/ that should help explain the bug. If you click on both links one after another, in Firefox the content will flip back and forth with no problems. In IE however (particularly IE7) if you go to the fiddle and then hit "Show Dynamic Content" then "Show Clone" then "Show Dynamic Content" then "Show Clone", the clone content is no longer visible. In fact it's not even injected into the DOM. It's like it disappears, or get erased somewhere along the way... Has anyone come across this bug and where I would start about fixing the issue.

谢谢!

http://jsfiddle.net/Vxyu3/12/

推荐答案

可能是一个闭包引用错误。尝试在全局范围内定义克隆参数,但将分配保留在就绪回调中。

May be a closure reference bug. Try defining the cloned parameter in global scope, but keep the assignment within the ready callback.

不,这不起作用。它看起来像一个jQuery / IE错误,其中为HTML()函数使用jQuery对象会导致一些问题。

No, that doesn't work. It looks like a jQuery/IE bug where using a jQuery object for the HTML() function causes some problems.

试试这个: domCloneMe。 html(cloned.html());

这篇关于jQuery .clone().html()在IE Bug中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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