File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 716716 index = 0 ,
717717 last , e1 , e2 , i ;
718718
719- if ( subtrees . length > 1 ) {
720- /* Two or more groups have been identified among the childnodes of t1
719+ if ( subtrees . length > 0 ) {
720+ /* One or more groups have been identified among the childnodes of t1
721721 * and t2.
722722 */
723- return this . attemptGroupRelocation ( t1 , t2 , subtrees , route ) ;
723+ diffs = this . attemptGroupRelocation ( t1 , t2 , subtrees , route ) ;
724+ if ( diffs . length > 0 ) {
725+ return diffs ;
726+ }
724727 }
725728
726729 /* 0 or 1 groups of similar child nodes have been found
Original file line number Diff line number Diff line change 2323 < h1 > Test for diffDOM</ h1 >
2424
2525 <!-- Add all divs to be compared here two by two -->
26+ < div > < p > first paragraph</ p > < img > < p > Another paragraph</ p > < p > A third paragraph</ p > < p > A fourth paragraph</ p > < p > A fifth paragraph</ p > </ div >
27+ < div > < img > < p > Another paragraph</ p > < p > A third paragraph</ p > < p > A fourth paragraph</ p > < p > A fifth paragraph</ p > </ div >
28+
2629 < div > < h1 > Foo</ h1 > < h2 > Bar</ h2 > < h3 > Baz</ h3 > </ div >
2730 < div > < h1 > Foo</ h1 > < h2 > Bar</ h2 > </ div >
2831
@@ -594,7 +597,7 @@ <h1>Test for diffDOM</h1>
594597 reportDiv ( ) ;
595598 print ( "diff operations for div #" + i + " → div #" + ( i + 1 ) ) ;
596599 diffs = dd . diff ( divs [ i ] , divs [ i + 1 ] ) ;
597- console . log ( diffs ) ;
600+ console . log ( JSON . stringify ( diffs ) ) ;
598601
599602 print ( "applying..." ) ;
600603 t1 = divs [ i ] . cloneNode ( true ) ;
@@ -604,7 +607,7 @@ <h1>Test for diffDOM</h1>
604607 print ( '...success!' ) ;
605608 } else {
606609 testFailure ( ) ;
607- console . log ( diffs ) ;
610+ console . log ( JSON . stringify ( diffs ) ) ;
608611 console . log ( t1 . outerHTML ) ;
609612 console . log ( divs [ i + 1 ] . outerHTML ) ;
610613 throw 'Outputs not matching' ;
@@ -618,7 +621,7 @@ <h1>Test for diffDOM</h1>
618621 testSuccess ( ) ;
619622 } else {
620623 testFailure ( ) ;
621- console . log ( diffs ) ;
624+ console . log ( JSON . stringify ( diffs ) ) ;
622625 console . log ( t1 . outerHTML ) ;
623626 console . log ( divs [ i ] . outerHTML ) ;
624627 throw 'Outputs not matching' ;
You can’t perform that action at this time.
0 commit comments