Fossil SCM
Corrected the JS-side recursive argument handling for the multiple-numbered-tables case.
Commit
a54fa928e2b86b3dfc64cdee1cf00f817617426456b565b291b2c962ac03349f
Parent
0b3919f3e13218b…
1 file changed
+8
-6
+8
-6
| --- src/fossil.numbered-lines.js | ||
| +++ src/fossil.numbered-lines.js | ||
| @@ -1,16 +1,18 @@ | ||
| 1 | 1 | (function callee(arg){ |
| 2 | 2 | /* JS counterpart of info.c:output_text_with_line_numbers() |
| 3 | 3 | which ties an event handler to the line numbers to allow |
| 4 | 4 | selection of individual lines or ranges. */ |
| 5 | 5 | var tbl = arg || document.querySelectorAll('table.numbered-lines'); |
| 6 | - if(!tbl) return; | |
| 7 | - else if(tbl.length>1){ | |
| 8 | - tbl.forEach( (t)=>callee(t) ); | |
| 9 | - return; | |
| 10 | - }else{ | |
| 11 | - tbl = tbl[0]; | |
| 6 | + if(!tbl) return /* no matching elements */; | |
| 7 | + else if(!arg){ | |
| 8 | + if(tbl.length>1){ /* multiple query results: recurse */ | |
| 9 | + tbl.forEach( (t)=>callee(t) ); | |
| 10 | + return; | |
| 11 | + }else{/* single query result */ | |
| 12 | + tbl = tbl[0]; | |
| 13 | + } | |
| 12 | 14 | } |
| 13 | 15 | const tdLn = tbl.querySelector('td'), |
| 14 | 16 | urlArgs = (window.location.search||'').replace(/&?\bln=[^&]*/,''); |
| 15 | 17 | console.debug("urlArgs =",urlArgs); |
| 16 | 18 | tdLn.addEventListener('click', function f(ev){ |
| 17 | 19 |
| --- src/fossil.numbered-lines.js | |
| +++ src/fossil.numbered-lines.js | |
| @@ -1,16 +1,18 @@ | |
| 1 | (function callee(arg){ |
| 2 | /* JS counterpart of info.c:output_text_with_line_numbers() |
| 3 | which ties an event handler to the line numbers to allow |
| 4 | selection of individual lines or ranges. */ |
| 5 | var tbl = arg || document.querySelectorAll('table.numbered-lines'); |
| 6 | if(!tbl) return; |
| 7 | else if(tbl.length>1){ |
| 8 | tbl.forEach( (t)=>callee(t) ); |
| 9 | return; |
| 10 | }else{ |
| 11 | tbl = tbl[0]; |
| 12 | } |
| 13 | const tdLn = tbl.querySelector('td'), |
| 14 | urlArgs = (window.location.search||'').replace(/&?\bln=[^&]*/,''); |
| 15 | console.debug("urlArgs =",urlArgs); |
| 16 | tdLn.addEventListener('click', function f(ev){ |
| 17 |
| --- src/fossil.numbered-lines.js | |
| +++ src/fossil.numbered-lines.js | |
| @@ -1,16 +1,18 @@ | |
| 1 | (function callee(arg){ |
| 2 | /* JS counterpart of info.c:output_text_with_line_numbers() |
| 3 | which ties an event handler to the line numbers to allow |
| 4 | selection of individual lines or ranges. */ |
| 5 | var tbl = arg || document.querySelectorAll('table.numbered-lines'); |
| 6 | if(!tbl) return /* no matching elements */; |
| 7 | else if(!arg){ |
| 8 | if(tbl.length>1){ /* multiple query results: recurse */ |
| 9 | tbl.forEach( (t)=>callee(t) ); |
| 10 | return; |
| 11 | }else{/* single query result */ |
| 12 | tbl = tbl[0]; |
| 13 | } |
| 14 | } |
| 15 | const tdLn = tbl.querySelector('td'), |
| 16 | urlArgs = (window.location.search||'').replace(/&?\bln=[^&]*/,''); |
| 17 | console.debug("urlArgs =",urlArgs); |
| 18 | tdLn.addEventListener('click', function f(ev){ |
| 19 |