Fix #12120. Always stack .before/.after, and fix disconnected nodes.

This commit is contained in:
Dave Methvin
2012-08-23 23:25:57 -04:00
parent 2263134b22
commit e2eac3f4d2
2 changed files with 9 additions and 13 deletions

View File

@@ -909,12 +909,13 @@ test("before(Function)", function() {
testBefore(manipulationFunctionReturningObj);
});
test("before and after w/ empty object (#10812)", function() {
expect(2);
test("before and after w/ empty object (#10812, #12120)", function() {
expect(3);
var res = jQuery( "#notInTheDocument" ).before( "(" ).after( ")" );
equal( res.length, 2, "didn't choke on empty object" );
equal( res.wrapAll("<div/>").parent().text(), "()", "correctly appended text" );
var res = jQuery("#notInTheDocument").before("<span>(</span>").after("<span>)</span>");
equal( res.length, 2, "added two elements to the empty object" );
equal( res.text(), "()", "correctly appended text" );
equal( res.end().text(), "(", "stacked the previous value" );
});
test("before and after on disconnected node (#10517)", function() {