Hacker News new | ask | show | jobs
by SquareWheel 2553 days ago
>AMP isn't a subset of HTML, it's it's own proprietary fork of HTML.

This is another misunderstanding. HTML allows custom tags. This is built into the spec. AMP is plain and regular, standards-compliant HTML.

2 comments

It is impossible to use AMP as a standalone Custom Element library and still validate as AMP. Valid AMP is required to dynamically load the library from Google's unversioned CDN.
That's true. But it's still valid HTML. It's most definitely not a fork of anything.

>unversioned CDN

Isn't the filename versioned (v0.js)?

Not really. The project leaders have explicitly stated that the content of the script at that URL is subject to change at any time, and thus users are prohibited from locking it to an audited, known version with an SRI hash.
I see. Thanks for the clarification. That is pretty poor practice.

I guess v0 might imply "beta" and thus not have stable API naming yet. But still, it's clearly being used in production at this point.

I think you are misunderstanding my point.

An img tag doesn't work on an AMP page. It has to be an amp-img. Every standard HTML tag is invalid in AMP content, as you must use a customized AMP flavor of HTML.

Whether or not it returns valid as HTML markup isn't really relevant: The point is it's an entirely different, incompatible, markup, from what a normal browser knows how to interpret and use, and if your browser doesn't have JavaScript, it's not even going to know what any of those custom tags are, is it?

That's not true, only tags that make web requests or do dynamic things are amp'd. You still use div and button and style and span and whatnot.
There is an important difference between saying it is invalid html, and it is invalid amp markup. An img tag will work like normal. It just won't be a valid AMP page any longer.

>if your browser doesn't have JavaScript, it's not even going to know what any of those custom tags are, is it?

It wouldn't. <noscript> tags are needed for that. But Javascript is a web standard, and this is the correct way to create new elements.