Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the deal with `html ⚡` in AMP pages?

Tags:

amp-html

I'm digging AMP html a bit and this line immediately got my attention.

AMP HTML documents MUST:

Contain a top-level <html ⚡> tag (<html amp> is accepted as well).

So my first question here is - is <html ⚡> valid HTML? I mean, it seems to work - but I looks really weird to me. Can anyone point me to specific rules for unicode as HTML attributes?

And my other question is, what it is used for. In the documentation there is stated that this is required for being a valid AMP document.

But dropping it doesn't lead to an AMP validation error. The JS source of AMP itself also doesn't seem to care at all about it.

Is this really the sign for crawlers and bots marking a document as AMP?

Thanks in advance. :)

like image 930
stefan judis Avatar asked Jun 13 '16 23:06

stefan judis


3 Answers

Tag names in HTML must begin with an ASCII letter, but attribute names can be nearly anything. See 12.2.4.32 Before attribute name state in the standard.

like image 24
Josh Lee Avatar answered Dec 20 '22 23:12

Josh Lee


You can use Unicode, or you can use <html amp>; either works. But you must use one to signal the status of the document. Failing to use one will fail AMP validation. I just use <html amp> because it's easier to type.

like image 133
Jay Gray Avatar answered Dec 20 '22 23:12

Jay Gray


You can still try it in W3C Markup Validation Service (known also as HTML validator, and yea, it's still exists!)

In case of validity it writes almost the same Error

Attribute amp not allowed on element html at this point. or

Attribute ⚡ not allowed on element html at this point.

AMP it's just not compatibile with HTML5 / HTML Living standard , something like extension, but without backwards compatibility.

HTML Element have list of allowed attributes ( http://w3c.github.io/html/single-page.html#the-html-element )

like image 22
iiic Avatar answered Dec 20 '22 21:12

iiic