amphtml: Validation should warn, not fail, for malformed hrefs
Currently an invalid or malformed href
value in a link will cause a validation error for AMP pages rather than a warning (“Prohibited or invalid use of HTML tag”, specifically.) This seems overly aggressive, since the consequence of such a link is simply that the link won’t be clickable. Currently only javascript:
hrefs are explicitly disallowed in AMP I believe, so unclear why malformed hrefs are rejected as well.
Could this be relaxed to produce a warning rather than a complete rejection of the document?
cc @cramforce
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 17 (14 by maintainers)
@rafaelhbarros , the ‘empty’ href case is now valid. It’s the easier case as it doesn’t require cache changes. Leaving the issue open for the ‘invalid’ href case.
Extending on invalid hrefs, I’d say that empty hrefs (
<a href="">link</a>
) should be valid as well (or be a warning, not a failure).@Gregable what Soy (Closure Templates) does in this case is instead of declaring the doc invalid is to sanitize the link (Basically rewriting to
about:blank
)I’m wondering if we can just accept input starting with
http:
andhttps:
, though. Seems safe.