Fossil SCM

Fix [c9525608f06] to ensure that we do not pass an empty CSS class name to domElement.classList.add(), as that breaks /pikchrshow and possibly other pages.

stephan 2026-07-09 14:44 UTC trunk
Commit db3c8e1e49633645d04d469ec70e037f53c01f5b9e8891567b345f750cc17ab0
1 file changed +2 -2
+2 -2
--- src/builtin.c
+++ src/builtin.c
@@ -705,12 +705,12 @@
705705
** Summary: custom skins which emit their own BODY need to have
706706
** the BODY element's CSS classes set so that various CSS selectors
707707
** and JS-side filters will work. */
708708
char *pSlash = strchr(g.zPath,'/')/*hack taken from style.c*/;
709709
if( pSlash ) *pSlash = 0;
710
- CX("document.body.classList.add(%!j, \"rpage-%j\","
711
- "\"cpage-%j\");\n",
710
+ CX("for(const x of [%!j, \"rpage-%j\",\"cpage-%j\"]) {"
711
+ "if(x) document.body.classList.add(x);};\n",
712712
style_get_current_feature(), g.zPath, g.zPhase+1);
713713
if( pSlash ) *pSlash = '/';
714714
}
715715
CX("if(fossil.config.skin.isDark) "
716716
"document.body.classList.add('fossil-dark-style');\n");
717717
--- src/builtin.c
+++ src/builtin.c
@@ -705,12 +705,12 @@
705 ** Summary: custom skins which emit their own BODY need to have
706 ** the BODY element's CSS classes set so that various CSS selectors
707 ** and JS-side filters will work. */
708 char *pSlash = strchr(g.zPath,'/')/*hack taken from style.c*/;
709 if( pSlash ) *pSlash = 0;
710 CX("document.body.classList.add(%!j, \"rpage-%j\","
711 "\"cpage-%j\");\n",
712 style_get_current_feature(), g.zPath, g.zPhase+1);
713 if( pSlash ) *pSlash = '/';
714 }
715 CX("if(fossil.config.skin.isDark) "
716 "document.body.classList.add('fossil-dark-style');\n");
717
--- src/builtin.c
+++ src/builtin.c
@@ -705,12 +705,12 @@
705 ** Summary: custom skins which emit their own BODY need to have
706 ** the BODY element's CSS classes set so that various CSS selectors
707 ** and JS-side filters will work. */
708 char *pSlash = strchr(g.zPath,'/')/*hack taken from style.c*/;
709 if( pSlash ) *pSlash = 0;
710 CX("for(const x of [%!j, \"rpage-%j\",\"cpage-%j\"]) {"
711 "if(x) document.body.classList.add(x);};\n",
712 style_get_current_feature(), g.zPath, g.zPhase+1);
713 if( pSlash ) *pSlash = '/';
714 }
715 CX("if(fossil.config.skin.isDark) "
716 "document.body.classList.add('fossil-dark-style');\n");
717

Keyboard Shortcuts

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