if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
if ( jQuery.nodeName( ret[i], "script" ) ) {
- scripts.push( ret[i].parentNode.removeChild( ret[i] ) );
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 )
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
});
test("appendTo(String|Element|Array<Element>|jQuery)", function() {
- expect(6);
+ expect(7);
var defaultText = 'Try them out:'
jQuery('<b>buga</b>').appendTo('#first');
equals( jQuery("#first").text(), defaultText + 'buga', 'Check if text appending works' );
jQuery([document.getElementById('first'), document.getElementById('yahoo')]).appendTo('#sap');
equals( expected, jQuery('#sap').text(), "Check for appending of array of elements" );
+ reset();
+ ok( jQuery(document.createElement("script")).appendTo("body").length, "Make sure a disconnected script can be appended." );
+
reset();
expected = document.querySelectorAll ?
"This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:" :