Fossil SCM

Remove some stray debug output. Make fossil.dom.remove() a bit more robust against passed-in elements which have already been removed from the DOM.

stephan 2025-04-10 06:08 chat-backoff-timer2
Commit 040a7d45037f08060ef8bd2141b0cad4da3cbeb680ffc6547224ee715460d78a
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -17,16 +17,16 @@
1717
return function(){
1818
return document.createElement(eType);
1919
};
2020
},
2121
remove: function(e){
22
- if(e.forEach){
22
+ if(e?.forEach){
2323
e.forEach(
24
- (x)=>x.parentNode.removeChild(x)
24
+ (x)=>x?.parentNode?.removeChild(x)
2525
);
26
- }else if(e.parentNode){
27
- e.parentNode.removeChild(e);
26
+ }else{
27
+ e?.parentNode?.removeChild(e);
2828
}
2929
return e;
3030
},
3131
/**
3232
Removes all child DOM elements from the given element
3333
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -17,16 +17,16 @@
17 return function(){
18 return document.createElement(eType);
19 };
20 },
21 remove: function(e){
22 if(e.forEach){
23 e.forEach(
24 (x)=>x.parentNode.removeChild(x)
25 );
26 }else if(e.parentNode){
27 e.parentNode.removeChild(e);
28 }
29 return e;
30 },
31 /**
32 Removes all child DOM elements from the given element
33
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -17,16 +17,16 @@
17 return function(){
18 return document.createElement(eType);
19 };
20 },
21 remove: function(e){
22 if(e?.forEach){
23 e.forEach(
24 (x)=>x?.parentNode?.removeChild(x)
25 );
26 }else{
27 e?.parentNode?.removeChild(e);
28 }
29 return e;
30 },
31 /**
32 Removes all child DOM elements from the given element
33
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -2666,11 +2666,11 @@
26662666
event, but a lot less explicable.
26672667
*/
26682668
()=>{
26692669
if( Chat.aPollErr.length ){
26702670
if(Chat.aPollErr.length>1){
2671
- console.warn('aPollErr',Chat.aPollErr);
2671
+ //console.warn('aPollErr',Chat.aPollErr);
26722672
if(Chat.aPollErr[1].name='timeout'){
26732673
/* mysterious pairs of HTTP 0 followed immediately
26742674
by timeout response; ignore the former in that case. */
26752675
Chat.aPollErr.shift();
26762676
}
@@ -2681,12 +2681,13 @@
26812681
1000
26822682
);
26832683
}
26842684
let nErr = 0;
26852685
F.fetch("chat-poll",{
2686
- timeout: 420 * 1000/*FIXME: get the value from the server*/,
2687
- //15000,
2686
+ timeout: 1
2687
+ ? 420 * 1000/*FIXME: get the value from the server*/
2688
+ : 15000,
26882689
urlParams:{
26892690
name: Chat.mxMsg
26902691
},
26912692
responseType: "json",
26922693
// Disable the ajax start/end handling for this long-polling op:
26932694
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -2666,11 +2666,11 @@
2666 event, but a lot less explicable.
2667 */
2668 ()=>{
2669 if( Chat.aPollErr.length ){
2670 if(Chat.aPollErr.length>1){
2671 console.warn('aPollErr',Chat.aPollErr);
2672 if(Chat.aPollErr[1].name='timeout'){
2673 /* mysterious pairs of HTTP 0 followed immediately
2674 by timeout response; ignore the former in that case. */
2675 Chat.aPollErr.shift();
2676 }
@@ -2681,12 +2681,13 @@
2681 1000
2682 );
2683 }
2684 let nErr = 0;
2685 F.fetch("chat-poll",{
2686 timeout: 420 * 1000/*FIXME: get the value from the server*/,
2687 //15000,
 
2688 urlParams:{
2689 name: Chat.mxMsg
2690 },
2691 responseType: "json",
2692 // Disable the ajax start/end handling for this long-polling op:
2693
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -2666,11 +2666,11 @@
2666 event, but a lot less explicable.
2667 */
2668 ()=>{
2669 if( Chat.aPollErr.length ){
2670 if(Chat.aPollErr.length>1){
2671 //console.warn('aPollErr',Chat.aPollErr);
2672 if(Chat.aPollErr[1].name='timeout'){
2673 /* mysterious pairs of HTTP 0 followed immediately
2674 by timeout response; ignore the former in that case. */
2675 Chat.aPollErr.shift();
2676 }
@@ -2681,12 +2681,13 @@
2681 1000
2682 );
2683 }
2684 let nErr = 0;
2685 F.fetch("chat-poll",{
2686 timeout: 1
2687 ? 420 * 1000/*FIXME: get the value from the server*/
2688 : 15000,
2689 urlParams:{
2690 name: Chat.mxMsg
2691 },
2692 responseType: "json",
2693 // Disable the ajax start/end handling for this long-polling op:
2694

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button