12

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. :)

stefan judis
  • 3,416
  • 14
  • 22

3 Answers3

8

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.

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
4

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.

Jay Gray
  • 1,706
  • 2
  • 20
  • 36
  • "Failing to use one will fail AMP validation" - AMP doesn't complain about leaving it out. – stefan judis Jun 14 '16 at 17:46
  • WIthout one or the other, the document will not appear in the Google CDN. Append your document to this prefix: `https://cdn.ampproject.org/c/` - use your URI without http or www. You'll get an error message. – Jay Gray Jun 15 '16 at 00:56
  • 1
    Stefan: That is not correct. See http://output.jsbin.com/wilayanawe/quiet#development=1 (in devtools console) – Malte Ubl Jun 15 '16 at 02:59
  • Thanks Malte. Thought the validations happens without development flag too. You're right. There is an error. :) – stefan judis Jun 15 '16 at 06:23
  • The dev console is one technique. The one I proposed will show the validated file in the CDN, or will show the same errors, if any, that are shown using the `#development=1` technique. My proposal does not require use of Chrome development tools. – Jay Gray Jun 15 '16 at 13:19
1

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 )

iiic
  • 1,366
  • 2
  • 15
  • 23