开发者

jQuery .clone() .html() in IE 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 injecte开发者_如何学God 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.

Thanks!

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.

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

Try this instead: domCloneMe.html(cloned.html());


Had to get around this by throwing the cloned object into a another div, hiding that div, and then appending its contents each time. Annoying and makes for longer code, but it's about the only thing that works right now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜