Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#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:


I try to use the following code to create a small DOM element.


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

        clone: function (elem, dataAndEvents, deepDataAndEvents) {
            var clone = elem.cloneNode(true),

            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.


I just create JsFiddle for testing this error.


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 anonymous

It will work correctly if HTML string is longer than max cache size.


Direct Link: http://fiddle.jshell.net/Soul_Master/mks7P/4/show/

comment:2 Changed 13 years ago by Rick Waldron

Resolution: duplicate
Status: newclosed

comment:3 Changed 13 years ago by Rick Waldron

Duplicate of #8052.

comment:4 Changed 13 years ago by jitter

Component: unfiledmanipulation
Milestone: 1.next1.5.1
Priority: undecidedhigh
Version 0, edited 13 years ago by jitter (next)
Note: See TracTickets for help on using tickets.