// 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] );
+ }
}
}
}
}
-})( jQuery );
\ No newline at end of file
+})( jQuery );
} 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 );
+ }
+});