TiddlyWiki / TiddlyWikiClassic

TiddlyWiki Classic (not to be confused with TiddlyWiki5: https://github.com/Jermolene/TiddlyWiki5)
https://classic.tiddlywiki.com/
492 stars 114 forks source link

$:/core/modules/widgets/checkbox.js creating incorrect tc-checkbox tag #283

Closed justin-hurd closed 1 year ago

justin-hurd commented 1 year ago

Within $:/core/modules/widgets/checkbox.js, on line 39, the tag applied is "tc-checkbox " with a space character, rather than the (I think) intended "tc-checkbox".

I wasn't sure whether or not this is the correct way to bring this up, but figured it would be a good fix to implement.

Jermolene commented 1 year ago

Hi @justin-hurd – this repo is actually the one for TiddlyWiki Classic; the TW5 one is at https://github.com/Jermolene/TiddlyWiki5

But to answer your question, the space is required in this context. The DOM "class" attribute is a space separated list of tokens, and here we're adding an additional class to those provided in the widget "class" attribute, so we need the space to separate the additional class from the other list.

justin-hurd commented 1 year ago

Whoops, my mistake. Is there a way I can move this to the TiddlyWiki 5 repo? I'm still a bit new to Github. That being said though, is there a way to prevent it from rendering as "tc-checkbox " in the HTML, such as "<label class="tc-checklist ">"?

Jermolene commented 1 year ago

Whoops, my mistake. Is there a way I can move this to the TiddlyWiki 5 repo? I'm still a bit new to Github.

Sadly no (there is an option to transfer issues but only to repos within the same organisation, but TiddlyWiki5 is in a different organisation).

That being said though, is there a way to prevent it from rendering as "tc-checkbox " in the HTML, such as "<label class="tc-checklist ">"?

We could do something like the following, but don't bother because the extra space character doesn't have a material impact.

    this.labelDomNode.setAttribute("class","tc-checkbox"  + (this.checkboxClass ? " " + this.checkboxClass : ""));
justin-hurd commented 1 year ago

Ah ok, if it doesn't really impact the TW, then no worries