Side navigation
#3500 closed bug (fixed)
Opened October 20, 2008 06:06PM UTC
Closed February 09, 2009 02:49PM UTC
Last modified March 14, 2012 05:43PM UTC
IE clone( true ) error on recloning
Reported by: | whoop06 | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | core | Version: | 1.3.1 |
Keywords: | clone ie7 ie6 | Cc: | |
Blocked by: | Blocking: |
Description
IE7 and IE6 give the error "'nodeType' is null or not an object" when attempting to clone an object that is itself a clone.
This error only occurs when the object has grandchildren and events attached to the object or its descendants.
An example can be found at http://kitchen.net-perspective.com/ie-clone-bug.html
Commenting out the IE specific block in the clone function (lines 278
- 291 in 1.2.6 core) alleviates the bug.
Attachments (0)
Change History (9)
Changed November 20, 2008 09:31AM UTC by comment:1
Changed November 20, 2008 10:57PM UTC by comment:2
As far as I know it hasn't been reviewed yet. The discussion for it is http://groups.google.com/group/jquery-dev/browse_thread/thread/a7e315e586bd66b9/ff0edad983daa459?lnk=gst&q=ie+clone#ff0edad983daa459
Changed December 17, 2008 07:18AM UTC by comment:3
Happened to me too, And then I thought, Why not cloning the first element instead the last?
The fix for the script (Not jQuery, but your example) is changing the row :
$( '.test:last' ).clone( true );
To :
$( '.test:first' ).clone( true );
Changed December 17, 2008 06:18PM UTC by comment:4
>"Why not cloning the first element instead the last?"
Because the point isn't to find a workaround for the simplified test case, but rather to illustrate the existence of a bug.
Changed December 18, 2008 05:48PM UTC by comment:5
Changed January 07, 2009 09:48PM UTC by comment:6
I have received this error for several clone circumstances. The underlying issue appears to be that the event re-attachment code for the cloned objects requires that the position of cloned elements be identical to the position of the original elements. (The event attachment code executes the each function on the original elements and references clone[i], where i is the position of the original element.)
I discovered that the clean function sometimes removes elements. In these cases, clone[i] is undefined where i >= clone.length but i < this.find("*").andSelf().length -- then undefined is passed to the jQuery.event.add function, and elem.nodeType in the add function throws the error.
To determine the number of dropped elements when you receive the error, insert the following line of code just after clone is initialized:
var diff = this.find("*").andSelf().length - clone.length;
I have not been able to pinpoint the area of the clean function that is removing these elements; I am hoping that someone will take this line of thought with the provided example and discover the root cause.
Changed January 20, 2009 03:49AM UTC by comment:7
Funny you should mention that, carmel_dev, I was looking at the clone() code and noticed that it depended on the node counts being identical as well. So I went looking for tickets that might be related to the two being out of sync.
Do you have some test cases that demonstrate the problem? I was thinking it might happen, for example, when adjacent text nodes are serialized into a string and then come back out as a single text node, but I couldn't reproduce a simple case.
Changed February 09, 2009 02:49PM UTC by comment:9
milestone: | 1.3 → 1.3.2 |
---|---|
resolution: | → fixed |
status: | new → closed |
version: | 1.2.6 → 1.3.1 |
Fixed in SVN rev [6186].
Is there any plans for this? It's just bit me with the simpleModal plugin.