Bug Tracker


Opened 6 years ago

Closed 6 years ago

Last modified 6 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 6 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 6 years ago by rwaldron

  • Resolution set to duplicate
  • Status changed from new to closed

comment:3 Changed 6 years ago by rwaldron

Duplicate of #8052.

comment:4 Changed 6 years ago by jitter

  • Component changed from unfiled to manipulation
  • Milestone changed from 1.next to 1.5.1
  • Priority changed from undecided to high
Version 0, edited 6 years ago by jitter (next)

Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Modify Ticket

Change Properties

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.