DEV Community

Discussion on: head is locked

Collapse
 
alohci profile image
Nicholas Stimpson

Hi Remy,

Thanks for your response. I'll try to cover as many points as I can.

The fact that the template element doesn't work in IE was not considered a problem for its introduction shows that that kind of backward incompatibility is not a blocker. Indeed, if new features had to work in old browsers, the entire web platform would be permanently locked.

As I said, what matters for backward compatibility is that old web pages don't break. So if a template element was widely used on pages, even though it would have been invalid HTML, before the current template element and its special parser behaviour was invented, that would have been a backward compatibility problem that would have stopped its invention. Presumably, WHATWG did research on how much use of a template element there was in the extant web before its introduction. I didn't see the discussions on it, but I have seen similar discussions on other elements.

It's still the responsibility of web authors to ensure that their new pages with the new HTML features are compatible with old browsers.

Which brings me on to the next point. Validity, and what is "allowed" plays no direct part in such changes, if for no other reason than inventing a new element must change in some way what is valid. What matters is browser behaviour. Browser behaviour (among other things) informs validity, but not vice versa.

I'm not sure what you mean by the "lost title". The title is still in the document, and the window or tab title bar still shows it, so I see no reason why it wouldn't be visible to screen readers or other AT.

Yes, stylesheet links work fine in body. As does base in modern browsers, though not IE. The HTML standard just says that the first base element with a href attribute in the document should be used. It says nothing about it needing to be in head. Because URLs get followed during parsing, it's necessary for the base element to precede in the markup any URL that needs to use it, but the inferred closing of head and opening of body doesn't change the order of the elements, so that's not a problem.

Thread Thread
 
remy profile image
Remy Sharp

Oh, my bad - when I looked at the IE11 rendered screenshot I was looking across the top and there was no title, but it is indeed there in the tab.

This screenshot shows that IE11 has indeed managed to read the title even though it's not in the head: cloudup.com/clxEBCmrXHA

So my key concern is invalid.

Validity and functionality in the old browsers isn't a concern (or one that I raised - I'd never expect IE11 to know what to do with it!) - because it doesn't break the IE11/old browser functionality.

So to close off discussion - you're absolutely right.


I do wonder what motivated the change to bring template into the head element knowing it would trigger closing the head tag. I'd guess the impact is limited as all the elements that normally reside in the head still work when they're in the body. Interestings but doubt if we'll ever know :)