Fossil SCM
Diff context loading: replaced string.replaceAll() with a more portable construct, as reported in [forum:c1f198f6993cd603 | forum post c1f198f6993cd603].
Commit
48887195881200aea08df9050d467c3f9498cfc9d821859595f2f4bf72607598
Parent
60206ef512f1ef5…
1 file changed
+8
-4
+8
-4
| --- src/fossil.diff.js | ||
| +++ src/fossil.diff.js | ||
| @@ -314,14 +314,18 @@ | ||
| 314 | 314 | ) ? trNext : false |
| 315 | 315 | /* Truthy if we want to combine trPrev, the new content, and |
| 316 | 316 | trNext into trPrev and then remove trNext. */; |
| 317 | 317 | let i, td; |
| 318 | 318 | if(!f.convertLines){ |
| 319 | + /* Reminder: string.replaceAll() is a relatively new | |
| 320 | + JS feature, not available in some still-widely-used | |
| 321 | + browser versions. */ | |
| 322 | + f.rx = [[/&/g, '&'], [/</g, '<']]; | |
| 319 | 323 | f.convertLines = function(li){ |
| 320 | - return li.join('\n') | |
| 321 | - .replaceAll('&','&') | |
| 322 | - .replaceAll('<','<')+'\n'; | |
| 324 | + var s = li.join('\n'); | |
| 325 | + f.rx.forEach((a)=>s=s.replace(a[0],a[1])); | |
| 326 | + return s + '\n'; | |
| 323 | 327 | }; |
| 324 | 328 | } |
| 325 | 329 | if(1){ // LHS line numbers... |
| 326 | 330 | const selector = '.difflnl > pre'; |
| 327 | 331 | td = tr.querySelector(selector); |
| @@ -343,11 +347,11 @@ | ||
| 343 | 347 | |
| 344 | 348 | if(1){// code block(s)... |
| 345 | 349 | const selector = '.difftxt > pre'; |
| 346 | 350 | td = tr.querySelectorAll(selector); |
| 347 | 351 | const code = f.convertLines(lines); |
| 348 | - let joinNdx = 0; | |
| 352 | + let joinNdx = 0/*selector[X] index to join together*/; | |
| 349 | 353 | td.forEach(function(e){ |
| 350 | 354 | const content = [e.innerHTML]; |
| 351 | 355 | if(doAppend) content.push(code); |
| 352 | 356 | else content.unshift(code); |
| 353 | 357 | if(joinTr){ |
| 354 | 358 |
| --- src/fossil.diff.js | |
| +++ src/fossil.diff.js | |
| @@ -314,14 +314,18 @@ | |
| 314 | ) ? trNext : false |
| 315 | /* Truthy if we want to combine trPrev, the new content, and |
| 316 | trNext into trPrev and then remove trNext. */; |
| 317 | let i, td; |
| 318 | if(!f.convertLines){ |
| 319 | f.convertLines = function(li){ |
| 320 | return li.join('\n') |
| 321 | .replaceAll('&','&') |
| 322 | .replaceAll('<','<')+'\n'; |
| 323 | }; |
| 324 | } |
| 325 | if(1){ // LHS line numbers... |
| 326 | const selector = '.difflnl > pre'; |
| 327 | td = tr.querySelector(selector); |
| @@ -343,11 +347,11 @@ | |
| 343 | |
| 344 | if(1){// code block(s)... |
| 345 | const selector = '.difftxt > pre'; |
| 346 | td = tr.querySelectorAll(selector); |
| 347 | const code = f.convertLines(lines); |
| 348 | let joinNdx = 0; |
| 349 | td.forEach(function(e){ |
| 350 | const content = [e.innerHTML]; |
| 351 | if(doAppend) content.push(code); |
| 352 | else content.unshift(code); |
| 353 | if(joinTr){ |
| 354 |
| --- src/fossil.diff.js | |
| +++ src/fossil.diff.js | |
| @@ -314,14 +314,18 @@ | |
| 314 | ) ? trNext : false |
| 315 | /* Truthy if we want to combine trPrev, the new content, and |
| 316 | trNext into trPrev and then remove trNext. */; |
| 317 | let i, td; |
| 318 | if(!f.convertLines){ |
| 319 | /* Reminder: string.replaceAll() is a relatively new |
| 320 | JS feature, not available in some still-widely-used |
| 321 | browser versions. */ |
| 322 | f.rx = [[/&/g, '&'], [/</g, '<']]; |
| 323 | f.convertLines = function(li){ |
| 324 | var s = li.join('\n'); |
| 325 | f.rx.forEach((a)=>s=s.replace(a[0],a[1])); |
| 326 | return s + '\n'; |
| 327 | }; |
| 328 | } |
| 329 | if(1){ // LHS line numbers... |
| 330 | const selector = '.difflnl > pre'; |
| 331 | td = tr.querySelector(selector); |
| @@ -343,11 +347,11 @@ | |
| 347 | |
| 348 | if(1){// code block(s)... |
| 349 | const selector = '.difftxt > pre'; |
| 350 | td = tr.querySelectorAll(selector); |
| 351 | const code = f.convertLines(lines); |
| 352 | let joinNdx = 0/*selector[X] index to join together*/; |
| 353 | td.forEach(function(e){ |
| 354 | const content = [e.innerHTML]; |
| 355 | if(doAppend) content.push(code); |
| 356 | else content.unshift(code); |
| 357 | if(joinTr){ |
| 358 |