Day 52 of 100DaysOfSpec, 4.2.4 The link element
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.2.4 The link element
Continuing on with document metadata today, and boy, the
link element section is dense.
link elements must have an
href (value is the URL of the resource) and a
rel attribute: “Relationship between the document containing the hyperlink and the destination resource”. Dropping either of these attributes renders the element useless, or is supposed to, at any rate.
There are two basic types of
link elements: references to external resources and hyperlinks.
link element can actually yield more than one “link” itself, depending on information stored in the
rel attribute. Which is a little unusual, as you think of most elements as having a 1:1 tag to semantic “item” ratio. The example they give:
<link rel="author license" href="/about">
That one element creates two different hyperlinks that point to the same page.
Links to external resources
For stylesheets and other resources that can be applied to the DOM,
- “User agents may opt to only try to obtain such resources when they are needed, instead of pro-actively fetching all the external resources that are not applied.”
- When applying these resources, the UA needs to allow 404s and redirects. A redirecting fetched resource seems like an unsavory idea for performance, but there you go.
- While the browser/UA tries to obtain the resource stored in the
linkelement, the webpage/document has to be blocked from loading. Which is (partially) why we limit the number of external resources we use and attempt to keep their file sizes as small as possible.
More about the
link element in tomorrow’s spec reading.