Re: [csswg-drafts] [css-device-adapt] Should Device Adaptation include a normative definition of <meta> viewport?

FWIW we try to keep all browser-affecting meta elements indexed in HTML; see https://html.spec.whatwg.org/multipage/semantics.html#standard-metadata-names. That way we can also include document conformance requirements, and ensure that the processing stays consistent with others (e.g. it reacts to insertion into the document/removal from the document, but doesn't pierce shadow trees).

It probably makes sense for the CSSWG to own the actual viewport-related processing model, though. So to me it makes sense to have CSSOM View define that part, then have a smaller bit in HTML. Something like:

> The value must be a [valid viewport string], which (does something useful).
>
> If any meta elements are inserted into the document or removed from the document, or existing meta elements have their name or content attributes changed, run the following steps:
>
> 1. Let _candidate elements_ be the list of all meta elements that meet the following criteria, in tree order:
>    - The element is in a document tree.
>    - The element has a name attribute, whose value is an ASCII case-insensitive match for viewport
>    - The element has a content attribute, whose value is not the empty string
> 2. Run the [process meta viewports] algorithm given the list containing each of _candidate element_'s content attribute values.

Here the []-delimited bits would be defined in CSSOM View, and the ()-delimited bit needs your help to describe.

Some notes:

- "valid viewport string" can be a strict what-we-want-authors-to-write definition, for HTML conformance checkers
- "process meta viewports" will need to do parsing (possibly more leniently than valid viewport string), and decide whether things that come first or last in the document have precedence, and whether you fall back to the lower-precedence one in the sequence if it's unparseable, or if you just give up and use the default... Lots of possibilities there.

We may also want to add a conformance requirement that you only include one meta viewport per document. Or maybe we want to allow multiple, if "process meta viewports" has a fallback mechanism, so you can e.g. use two and fallback in browsers that don't support one.

I'm happy to help with the HTML side of this BTW :).

-- 
GitHub Notification of comment by domenic
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/331#issuecomment-355855190 using your GitHub account

Received on Sunday, 7 January 2018 21:44:20 UTC