Skip to main content

Day 59 of 100DaysOfSpec, 4.3 Sections

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading in 4.3 Sections

Hooray! Finally starting on elements outside the <head>.

4.3.1 The body element

body == document content. You need to have only one in your document to conform to HTML standards. To review a previous section—forget which—you can actually can drop an opening or closing tag under special conditions (see spec, because why bother doing this?).

There’s…some craziness about event handler bubbling. For the onblur, onerror, onfocus, onload, onresize, and onscroll event handlers: the event handler content attributes would get triggered first on whatever element (child of body) the handler is set on, then on html, and THEN on body, rather than triggering directly up the chain. “A regular event listener attached to the body using addEventListener(), however, would be run when the event bubbled through the body and not when it reaches the Window object.”

I need to learn more about Javascript, because I feel like if I did, this would make more sense to me / leave a more impactful impression / explain some problems I might have while writing code.

4.3.2 The article element

The article “represents a complete, or self-contained, composition” that could stand on its own for, say, syndication. Examples they give are: “a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget…” To me forum post/comment doesn’t match the definition of an article’s semantic value: yes, you can subscribe to comments, etc, via an RSS feed, but it doesn’t really make sense (to me) to independently distribute a comment without the original post.

Interesting bits:

  • Can’t contain main elements as descendants.
  • Nesting articles can be semantically sound.
  • Nested article elements should not be associated with author info that applies to the ancestral article element.

And I’m just going to leave this here because I feel like it would come up for a lot of people in “when to use what”:

“When the main content of the page (i.e. excluding footers, headers, navigation blocks, and sidebars) is all one single self-contained composition, the content should be marked up with a main element and the content may also be marked with an article, but it is technically redundant in this case (since it's self-evident that the page is a single composition, as it is a single document).”

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.