Skip to main content

Day 41 of 100DaysOfSpec, 3.2.5 Global Attributes

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 3.2.5 Global Attributes

These attributes can be added to any HTML* element:

  • accesskey
  • class
  • contenteditable
  • dir
  • hidden
  • id
  • lang
  • spellcheck
  • style
  • tabindex
  • title
  • translate

*Specifically HTML. An element in another namespace, like XML, doesn't get these attributes, but inherits from an ancestral HTML element.

There's also a long list of event handler content attributes that can be set on any HTML element. Spans things like events from user input, changes to the document, changes to audio/video status, etc. The list is interesting because you could call onvolumechange on a div, but that would be ineffectual.

As mentioned earlier in the spec, you can also place a custom data attribute ("data-[whateveryouwantgurl]") on any HTML element.

Responses

My blog uses Webmentions. Responses from sites which likewise support Webmentions, such as Twitter or people’s personal sites, will show up here.

No Webmentions have been sent to this post yet.