Day 34 of 100DaysOfSpec, 3.1.3 DOM tree accessors
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.1.3 DOM tree accessors
3.1.3 DOM tree accessors
"The html element of a document is the document's root element, if there is one and it's an html element, or null otherwise." <— LOL stating the obvious but yeah I guess if this is a legally-binding document for UAs in some markets, sure.
head attribute is the first
head element. What happens if you're silly and include two
heads? I modified a page to include a second head with a CSS file in it and: the w3c validator throws errors as "stray start tag head", "link element between head and body", and "cannot recover after last error. Any further errors will be ignored". Latest browsers across the board appear ignore the second
headwithout displaying a warning in the console.
Hey! You can have a title on an SVG element. Makes sense, it is a document. By the way, the SVG spec was recently updated, that should be interesting and possibly more readable than the HTML spec.
The document's body element is the first
The images, embeds, plugins, links, forms, and scripts attributes defined in 3.1.1 all return an HTMLCollection (ex:
The getElementsByName() method returns a NodeList with all the elements in the document that match the name passed to the method; these elements are listed in order of appearance and not by how many Oscars they've won.
"Supported property names" comes from the "name" attribute on applet, exposed embed, form, iframe, img, and exposed object elements in the document, as well as from IDs on applet, exposed object, and img elements that do not have empty "name" attributes. Duplicate names are ignored, and if an element has both a "name" and an "ID", the ID wins. The ID always wins...