This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -689,12 +689,7 @@ forEach({
689
689
if ( element . nodeType === 1 ) {
690
690
var index = element . firstChild ;
691
691
forEach ( new JQLite ( node ) , function ( child ) {
692
- if ( index ) {
693
- element . insertBefore ( child , index ) ;
694
- } else {
695
- element . appendChild ( child ) ;
696
- index = child ;
697
- }
692
+ element . insertBefore ( child , index ) ;
698
693
} ) ;
699
694
}
700
695
} ,
Original file line number Diff line number Diff line change @@ -1023,6 +1023,18 @@ describe('jqLite', function() {
1023
1023
expect ( root . prepend ( 'abc' ) ) . toEqual ( root ) ;
1024
1024
expect ( root . html ( ) . toLowerCase ( ) ) . toEqual ( 'abctext' ) ;
1025
1025
} ) ;
1026
+ it ( 'should prepend array to empty in the right order' , function ( ) {
1027
+ var root = jqLite ( '<div>' ) ;
1028
+ expect ( root . prepend ( [ a , b , c ] ) ) . toBe ( root ) ;
1029
+ expect ( sortedHtml ( root ) ) .
1030
+ toBe ( '<div><div>A</div><div>B</div><div>C</div></div>' ) ;
1031
+ } ) ;
1032
+ it ( 'should prepend array to content in the right order' , function ( ) {
1033
+ var root = jqLite ( '<div>text</div>' ) ;
1034
+ expect ( root . prepend ( [ a , b , c ] ) ) . toBe ( root ) ;
1035
+ expect ( sortedHtml ( root ) ) .
1036
+ toBe ( '<div><div>A</div><div>B</div><div>C</div>text</div>' ) ;
1037
+ } ) ;
1026
1038
} ) ;
1027
1039
1028
1040
You can’t perform that action at this time.
0 commit comments