var next = this.nextSibling,
parent = this.parentNode;
- if ( parent && this.nodeType === 1 || this.nodeType === 11 ) {
-
+ if ( parent ) {
jQuery( this ).remove();
-
- if ( next ) {
- next.parentNode.insertBefore( elem, next );
- } else {
- parent.appendChild( elem );
- }
+ parent.insertBefore( elem, next );
}
});
},
var testReplaceWith = function( val ) {
var tmp, y, child, child2, set, non_existent, $div,
- expected = 22;
+ expected = 23;
expect( expected );
ok( jQuery("#mark")[ 0 ], "Replace element with set of elements" );
ok( !jQuery("#groups")[ 0 ], "Verify that original element is gone, after set of elements" );
+ tmp = jQuery("<b>content</b>")[0];
+ jQuery("#anchor1").contents().replaceWith( val(tmp) );
+ deepEqual( jQuery("#anchor1").contents().get(), [ tmp ], "Replace text node with element" );
+
tmp = jQuery("<div/>").appendTo("#qunit-fixture").click(function() {
ok( true, "Newly bound click run." );