website source; use git clone git:// to clone this repository. (7162B)

      1 # HTSS: HyperText Semantic Subset
      3 This is a draft for a proposed subset of (X)HTML5. None of this information is final and is subject to change without notice.
      5 ## Why this instead of AMP?
      7 - AMP encourages/requires use of JS.
      8 - AMP utilises nonstandard HTML tags that require the use of JS to interpret.
      9 - AMP requires assets from a centrally-operated entity (
     10 - AMP is currently designed to be served alongside the "canonical" HTML content. The goal with HTSS is to provide a regular subset of HTML expressive enough to serve as the canonical version.
     11 - AMP does not address accessibility concerns.
     13 As an aside, AMP seems to invent the solution to a problem that only surfaced in the Web's later years. To load pages quickly, web developers and designers simply need to emphasise simplicity, and make do with more of the features of bare HTML5. Advertisers must find less-intrusive ways to market their products without compromising on usability, as well. There is plenty of literature online about AMP if you are still not convinced of its uselessness and potential harm to the Web ecosystem.
     15 ## Key points
     17 - HTML documents are for HTML; it should not consist of mixed mimetypes. While JS and CSS are allowed in HTML, reserved HTML tokens still need to be entity-escaped or enclosed in a CDATA tag. The ideal solution is to serve non-HTML as separate files. This also aids in clientside caching and capabilities: the client does not have to download assets it already has, and it does not have to download assets it cannot display (CSS and images inside a text browser or screen reader, for instance). Additionally, this makes HTML cleaner by removing the use of `[onhover]`, `[style]`, and other tag attributes.
     18 - Content should be the primary focus. Content should either be at the very top of the page, before any navigational or supplementary site information, or accessible via a "skip to content" anchor located at the top of the page.
     19 - Websites should be easily navigable without the aid of CSS or JS. These assets should be additive, not required.
     20 - Making full use of the HTML5 standard is desirable over accepting third-party additions to the specification. Make use of standard markup when possible.
     22 ## What is required?
     24 - HTSS is a subset of HTML5 or XHTML5, therefore the document must begin with an HTML5-compatible doctype, e.g. `<!DOCTYPE html>` or `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html>`. All other (X)HTML5 rules also apply.
     25 - HTSS must be advertised as an HTML- or XML-compatible mimetype such as `text/html` or `application/xhtml+xml`.
     26 - HTSS suggests the use of XHTML5 rather than the SGML-based grammar, but for now this is not a requirement and both the full syntax specifications of HTML5 and XHTML5 are allowed.
     28 ## Tag and attribute requirements
     30 Which tags and attributes have specific requirements in HTSS? (CSS selectors are used to refer to tags and their attributes in this section.)
     32 - Global attributes:
     33   - `[lang]` (`[xml:lang]` is also acceptable for XHTML5) should be used whenever an element's language is different from its parent: for instance, `html[lang=en-US]` defines a document as United States English, which may have a Latin excerpt as `blockquote[lang=la]`.
     34 - `html`:
     35   - `html[xmlns]` is required for XHTML5-valid HTSS.
     36 - `b`: Matches the HTML5 semantic meaning, when `strong` and `mark` are not appropriate.
     37 - `i`: Matches the HTML5 semantic meaning, in that it is intended to set off foreign language text, jargon, or internal dialogue.
     38   - Use `i[lang]` when offsetting inline foreign terms.
     39 - `u`: Matches the HTML5 semantic meaning.
     40 - `q` must be used for quotations rather than the use of the `"` or `'` characters or any smartquote or localised variants (including `«` `»` `“` `”` `‘` `’`). Use CSS to ensure the correct quotation characters are shown in the browser.
     41 - `div`, `span`: Used for non-semantic sectioning of the HTML document, primarily useful for CSS. These must not be used when an alternative tag is available to convey the semantic meaning of the content.
     42 - Following recommendation, `pre` tags denote preformatted text (text that should not wrap or have its whitespace condensed). It alone is not for source code; a `code` tag shall be used within a `pre` tag to denote a block of code.
     43 - `code`: Following HTML5 recommendation, `[class^="language-"]` (e.g. `<code class="language-html"/>`) may be used to denote the programming language. This has the side effect of being recognised by popular syntax highlighting scripts.
     44 - `kbd`, `samp`, `var` follow their HTML5 semantic meanings and should be used in place of `code` when it makes sense.
     45 - `table`: Must be used semantically for tabular *data* and not simply for styling (use `div` and CSS for that).
     47 ## Forbidden tags and attributes
     49 Which tags and attributes are forbidden in HTSS?
     51 - Global attributes:
     52   - `[style]` violates the exclusion of `text/css` content inside HTSS. Use separate stylesheets with appropriate selectors, for instance the use of `[id]` or `[class]` attributes.
     53 - Event handler attributes (`[on*]` JavaScript attributes such as `[onclick]`). These violate the exclusion of `application/javascript` inside HTSS. Include script files as separate assets and register callbacks from within the script.
     54 - Any HTML5 tag or attribute marked deprecated.
     55 - Any HTML5 tag or attribute marked nonstandard and/or vendor-specific.
     57 ## Suggestions for automated HTSS linting
     59 Just as validators and linters exist for HTML and AMP, it is useful to have a preliminary linting for documents trying to conform to HTSS. Note that since many of the rules are semantic in nature, an automated system cannot be expected to discern correct usage of tags, as it cannot understand the content of a document in the same capacity that a human can. Such an HTSS linter could only catch low-hanging fruit: obvious syntactic violations of HTSS, such as invalid tags.
     61 Such information is also useful in creating other software that prioritises HTSS, such as an HTSS-conformant Web browser.
     63 - As HTSS is a subset of HTML5 or XHTML5, HTSS must first validate as HTML5 or XHTML5.
     64 - All elements that are [deprecated or obsolete as defined in HTML5][MDN-deprecated], are not allowed in HTSS.
     65 - Event handler attributes (as mentioned above, the `[on*]` global attributes for JavaScript) and `[style]` attribute are not allowed in HTSS.
     67 [MDN-deprecated]: <> "Obsolete and deprecated HTML elements"
     69 ## Other
     71 Not in scope for HTSS, but additional points to consider:
     73 - Use of normalised URIs that are easily mapped to the underlying filesystem; meaning:
     74   - the use of file extensions such as `.html` or `.htm`, `.xhtml` or `.xht`, `.css`, `.svg`, et cetera; and
     75   - directories requiring trailing slash and displaying a predefined index page, for example `/videos/` for the video section of a website.
     76 - On UNIX-based systems, the use of file permissions to denote executable (CGI) resources.
     77 - Simple subset of HTTP as well, see [HTTP/0.2]( for a potential solution.