File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -643,11 +643,23 @@ private static bool CompareElements(
643643 )
644644 {
645645 Logger . Debug ( $ "Found match for '{ GetElementInfo ( originalChild ) } ' in the next child of '{ GetElementInfo ( modifiedElem ) } '.") ;
646- XElement addOp = new XElement (
647- "add" ,
648- new XAttribute ( "sel" , GenerateXPath ( originalChild , pathOptions ) ) ,
649- new XAttribute ( "pos" , "before" )
650- ) ;
646+ XElement addOp ;
647+ if ( i > 0 )
648+ {
649+ addOp = new XElement (
650+ "add" ,
651+ new XAttribute ( "sel" , GenerateXPath ( originalChildren [ i - 1 ] , pathOptions ) ) ,
652+ new XAttribute ( "pos" , "after" )
653+ ) ;
654+ }
655+ else
656+ {
657+ addOp = new XElement (
658+ "add" ,
659+ new XAttribute ( "sel" , GenerateXPath ( originalElem , pathOptions ) ) ,
660+ new XAttribute ( "pos" , "prepend" )
661+ ) ;
662+ }
651663 for ( int l = j ; l < k ; l ++ )
652664 {
653665 var addedChild = modifiedChildren [ l ] ;
You can’t perform that action at this time.
0 commit comments