#8080 closed bug (duplicate)
NoCloneEvent flag in jQuery.support is not correct on IE9.
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.5.1 |
Component: | manipulation | Version: | 1.5rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I try to use the following code to create a small DOM element.
$('<span>test</span>');
But I got error on IE9(Post Beta Build 8027) jQuery will cache this DOM in somewhere and clone the cached DOM object by calling the following method
jQuery.extend({ clone: function (elem, dataAndEvents, deepDataAndEvents) { var clone = elem.cloneNode(true), srcElements, destElements, i; if (!jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. // Using Sizzle here is crazy slow, so we use getElementsByTagName // instead srcElements = elem.getElementsByTagName("*"); destElements = clone.getElementsByTagName("*");
I found that jQuery.support.noCloneEvent object is invalid when compare with other browser that is the cause of error(It try to execute the following but elem has not method name getElementsByTagName).
srcElements = elem.getElementsByTagName("*");
After I trace all related code, I found that elem object is created by createDocumentFragment method in document object. The error code equals with my below code that does not work both on IE9 and Chrome 8.
document.createDocumentFragment().getElementsByTagName("*");
I just create JsFiddle for testing this error.
http://jsfiddle.net/Soul_Master/ZE82B/1/
But it will works correctly because it forces IE9 to render with "EmulateIE7" mode so you should directly call real web page or use my following link.
Change History (4)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:4 Changed 13 years ago by
Component: | unfiled → manipulation |
---|---|
Milestone: | 1.next → 1.5.1 |
Priority: | undecided → high |
It will work correctly if HTML string is longer than max cache size.
http://jsfiddle.net/Soul_Master/mks7P/4/
Direct Link: http://fiddle.jshell.net/Soul_Master/mks7P/4/show/