Fossil SCM
Actually check that the link being clicked is a descendant of .subdir instead of using a style-based check that could change with different CSS.
Commit
21dccee9dc95f4d005a44eb43c5d6168a56449e0
Parent
1ab27288206bc8a…
1 file changed
+3
-2
+3
-2
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -620,19 +620,20 @@ | ||
| 620 | 620 | @ lists[i].style.display = display; |
| 621 | 621 | @ } |
| 622 | 622 | @ } |
| 623 | 623 | @ |
| 624 | 624 | @ var outer_ul = document.querySelector('.filetree > ul'); |
| 625 | + @ var subdir = outer_ul.querySelector('.subdir'); | |
| 625 | 626 | @ outer_ul.querySelector('.subdir > a').style.cursor = 'pointer'; |
| 626 | 627 | @ outer_ul.onclick = function( e ){ |
| 627 | 628 | @ var a = e.target; |
| 628 | 629 | @ if( a.nodeName!='A' ) return; |
| 629 | - @ if( a.parentNode.className.indexOf('subdir')>=0 ){ | |
| 630 | + @ if( a.parentNode==subdir ){ | |
| 630 | 631 | @ toggleAll(outer_ul); |
| 631 | 632 | @ return false; |
| 632 | 633 | @ } |
| 633 | - @ if( style(a.parentNode, 'display')=='inline' ) return; | |
| 634 | + @ if( !subdir.contains(a) ) return; | |
| 634 | 635 | @ var ul = a.nextSibling; |
| 635 | 636 | @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; |
| 636 | 637 | @ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none'; |
| 637 | 638 | @ return false; |
| 638 | 639 | @ } |
| 639 | 640 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -620,19 +620,20 @@ | |
| 620 | @ lists[i].style.display = display; |
| 621 | @ } |
| 622 | @ } |
| 623 | @ |
| 624 | @ var outer_ul = document.querySelector('.filetree > ul'); |
| 625 | @ outer_ul.querySelector('.subdir > a').style.cursor = 'pointer'; |
| 626 | @ outer_ul.onclick = function( e ){ |
| 627 | @ var a = e.target; |
| 628 | @ if( a.nodeName!='A' ) return; |
| 629 | @ if( a.parentNode.className.indexOf('subdir')>=0 ){ |
| 630 | @ toggleAll(outer_ul); |
| 631 | @ return false; |
| 632 | @ } |
| 633 | @ if( style(a.parentNode, 'display')=='inline' ) return; |
| 634 | @ var ul = a.nextSibling; |
| 635 | @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; |
| 636 | @ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none'; |
| 637 | @ return false; |
| 638 | @ } |
| 639 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -620,19 +620,20 @@ | |
| 620 | @ lists[i].style.display = display; |
| 621 | @ } |
| 622 | @ } |
| 623 | @ |
| 624 | @ var outer_ul = document.querySelector('.filetree > ul'); |
| 625 | @ var subdir = outer_ul.querySelector('.subdir'); |
| 626 | @ outer_ul.querySelector('.subdir > a').style.cursor = 'pointer'; |
| 627 | @ outer_ul.onclick = function( e ){ |
| 628 | @ var a = e.target; |
| 629 | @ if( a.nodeName!='A' ) return; |
| 630 | @ if( a.parentNode==subdir ){ |
| 631 | @ toggleAll(outer_ul); |
| 632 | @ return false; |
| 633 | @ } |
| 634 | @ if( !subdir.contains(a) ) return; |
| 635 | @ var ul = a.nextSibling; |
| 636 | @ while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling; |
| 637 | @ ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none'; |
| 638 | @ return false; |
| 639 | @ } |
| 640 |