Using self-closing tags for widgets

55 views
Skip to first unread message

soren.b...@gmail.com

unread,
Nov 24, 2020, 7:57:55 PM11/24/20
to TiddlyWiki
Today I learned that I've been wrong about self-closing tags (e.g., <img />) in HTML5 for years. The new rules appear to be that they are allowed but meaningless on void elements (those that don't allow content), and entirely disallowed on any other elements.

Most TiddlyWiki widgets that don't have content use the self-closing syntax in the documentation (e.g., macrocall), and state that the content is "ignored". My question is, are these widgets defined like HTML5 void elements, so that they won't gobble up any body content if I don't close them? In that case, I would do best to simply stop using self-closing tags altogether, since they no longer have any meaning in modern HTML. Or would that potentially cause issues with the wikitext parser gobbling up other stuff as part of the "ignored" content, so that I should continue using the self-closing tags, but only for widgets?

Jeremy Ruston

unread,
Nov 25, 2020, 4:46:05 AM11/25/20
to TiddlyWiki Group
Hi Soren

TW5 treats the following tags as void. This means that  no terminating </tag> is needed (indeed, if one is provided it will be ignored and treated as plain text), and the <tag/> syntax:

area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr

If you don’t close any other tag then it will behave as if the missing closing tag were at the end of the tiddler.

I’ve updated the docs to add these details:


Best wishes

Jeremy

On 25 Nov 2020, at 00:57, soren.b...@gmail.com <soren.b...@gmail.com> wrote:

Today I learned that I've been wrong about self-closing tags (e.g., <img />) in HTML5 for years. The new rules appear to be that they are allowed but meaningless on void elements (those that don't allow content), and entirely disallowed on any other elements.

Most TiddlyWiki widgets that don't have content use the self-closing syntax in the documentation (e.g., macrocall), and state that the content is "ignored". My question is, are these widgets defined like HTML5 void elements, so that they won't gobble up any body content if I don't close them? In that case, I would do best to simply stop using self-closing tags altogether, since they no longer have any meaning in modern HTML. Or would that potentially cause issues with the wikitext parser gobbling up other stuff as part of the "ignored" content, so that I should continue using the self-closing tags, but only for widgets?

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/586e11d9-0d4c-4322-8e24-ec865401c510n%40googlegroups.com.

soren.b...@gmail.com

unread,
Nov 25, 2020, 7:51:57 AM11/25/20
to TiddlyWiki
Thanks Jeremy!
Reply all
Reply to author
Forward
0 new messages