mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
jQuery.clone() check that destination child nodes are not null. Fixes #9587
This commit is contained in:
parent
d59b0f3e27
commit
5c3b9e0c24
@ -564,7 +564,10 @@ jQuery.extend({
|
||||
// with an element if you are cloning the body and one of the
|
||||
// elements on the page has a name or id of "length"
|
||||
for ( i = 0; srcElements[i]; ++i ) {
|
||||
cloneFixAttributes( srcElements[i], destElements[i] );
|
||||
// Ensure that the destination node is not null; Fixes #9587
|
||||
if ( destElements[i] ) {
|
||||
cloneFixAttributes( srcElements[i], destElements[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,6 +281,8 @@ Z</textarea>
|
||||
</div>
|
||||
|
||||
<div id="fx-tests"></div>
|
||||
|
||||
<div id="no-clone-exception"><object><embed></embed></object></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1465,3 +1465,14 @@ test("jQuery.buildFragment - plain objects are not a document #8950", function()
|
||||
} catch (e) {}
|
||||
|
||||
});
|
||||
|
||||
test("jQuery.clone - no exceptions for object elements #9587", function() {
|
||||
expect(1);
|
||||
|
||||
try {
|
||||
jQuery("#no-clone-exception").clone();
|
||||
ok( true, "cloned with no exceptions" );
|
||||
} catch( e ) {
|
||||
ok( false, e.message );
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user