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 @@ -715,12 +715,7 @@ forEach({
715
715
if ( element . nodeType === 1 ) {
716
716
var index = element . firstChild ;
717
717
forEach ( new JQLite ( node ) , function ( child ) {
718
- if ( index ) {
719
- element . insertBefore ( child , index ) ;
720
- } else {
721
- element . appendChild ( child ) ;
722
- index = child ;
723
- }
718
+ element . insertBefore ( child , index ) ;
724
719
} ) ;
725
720
}
726
721
} ,
Original file line number Diff line number Diff line change @@ -1075,6 +1075,18 @@ describe('jqLite', function() {
1075
1075
expect ( root . prepend ( 'abc' ) ) . toEqual ( root ) ;
1076
1076
expect ( root . html ( ) . toLowerCase ( ) ) . toEqual ( 'abctext' ) ;
1077
1077
} ) ;
1078
+ it ( 'should prepend array to empty in the right order' , function ( ) {
1079
+ var root = jqLite ( '<div>' ) ;
1080
+ expect ( root . prepend ( [ a , b , c ] ) ) . toBe ( root ) ;
1081
+ expect ( sortedHtml ( root ) ) .
1082
+ toBe ( '<div><div>A</div><div>B</div><div>C</div></div>' ) ;
1083
+ } ) ;
1084
+ it ( 'should prepend array to content in the right order' , function ( ) {
1085
+ var root = jqLite ( '<div>text</div>' ) ;
1086
+ expect ( root . prepend ( [ a , b , c ] ) ) . toBe ( root ) ;
1087
+ expect ( sortedHtml ( root ) ) .
1088
+ toBe ( '<div><div>A</div><div>B</div><div>C</div>text</div>' ) ;
1089
+ } ) ;
1078
1090
} ) ;
1079
1091
1080
1092
You can’t perform that action at this time.
0 commit comments