File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ jQuery.fn.extend({
154154 this . parentNode . insertBefore ( elem , this ) ;
155155 } ) ;
156156 } else if ( arguments . length ) {
157- var set = jQuery ( arguments [ 0 ] ) ;
157+ var set = jQuery . clean ( arguments ) ;
158158 set . push . apply ( set , this . toArray ( ) ) ;
159159 return this . pushStack ( set , "before" , arguments ) ;
160160 }
@@ -167,7 +167,7 @@ jQuery.fn.extend({
167167 } ) ;
168168 } else if ( arguments . length ) {
169169 var set = this . pushStack ( this , "after" , arguments ) ;
170- set . push . apply ( set , jQuery ( arguments [ 0 ] ) . toArray ( ) ) ;
170+ set . push . apply ( set , jQuery . clean ( arguments ) ) ;
171171 return set ;
172172 }
173173 } ,
Original file line number Diff line number Diff line change @@ -794,6 +794,14 @@ test("before(Function)", function() {
794794 testBefore ( functionReturningObj ) ;
795795} )
796796
797+ test ( "before and after w/ empty object (#10812)" , function ( ) {
798+ expect ( 2 ) ;
799+
800+ var res = jQuery ( "#notInTheDocument" ) . before ( "(" ) . after ( ")" ) ;
801+ equal ( res . length , 2 , "didn't choke on empty object" ) ;
802+ equal ( res . wrap ( "<div/>" ) . parent ( ) . text ( ) , "()" , "correctly appended text" ) ;
803+ } ) ;
804+
797805test ( "insertBefore(String|Element|Array<Element>|jQuery)" , function ( ) {
798806 expect ( 4 ) ;
799807 var expected = "This is a normal link: bugaYahoo" ;
You can’t perform that action at this time.
0 commit comments