File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 716
716
index = 0 ,
717
717
last , e1 , e2 , i ;
718
718
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
721
721
* and t2.
722
722
*/
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
+ }
724
727
}
725
728
726
729
/* 0 or 1 groups of similar child nodes have been found
Original file line number Diff line number Diff line change 23
23
< h1 > Test for diffDOM</ h1 >
24
24
25
25
<!-- 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
+
26
29
< div > < h1 > Foo</ h1 > < h2 > Bar</ h2 > < h3 > Baz</ h3 > </ div >
27
30
< div > < h1 > Foo</ h1 > < h2 > Bar</ h2 > </ div >
28
31
@@ -594,7 +597,7 @@ <h1>Test for diffDOM</h1>
594
597
reportDiv ( ) ;
595
598
print ( "diff operations for div #" + i + " → div #" + ( i + 1 ) ) ;
596
599
diffs = dd . diff ( divs [ i ] , divs [ i + 1 ] ) ;
597
- console . log ( diffs ) ;
600
+ console . log ( JSON . stringify ( diffs ) ) ;
598
601
599
602
print ( "applying..." ) ;
600
603
t1 = divs [ i ] . cloneNode ( true ) ;
@@ -604,7 +607,7 @@ <h1>Test for diffDOM</h1>
604
607
print ( '...success!' ) ;
605
608
} else {
606
609
testFailure ( ) ;
607
- console . log ( diffs ) ;
610
+ console . log ( JSON . stringify ( diffs ) ) ;
608
611
console . log ( t1 . outerHTML ) ;
609
612
console . log ( divs [ i + 1 ] . outerHTML ) ;
610
613
throw 'Outputs not matching' ;
@@ -618,7 +621,7 @@ <h1>Test for diffDOM</h1>
618
621
testSuccess ( ) ;
619
622
} else {
620
623
testFailure ( ) ;
621
- console . log ( diffs ) ;
624
+ console . log ( JSON . stringify ( diffs ) ) ;
622
625
console . log ( t1 . outerHTML ) ;
623
626
console . log ( divs [ i ] . outerHTML ) ;
624
627
throw 'Outputs not matching' ;
You can’t perform that action at this time.
0 commit comments