Re: [css-device-adapt] Accepting semi-colons as a separator for meta-viewport

For example, I quickly found 33 major mobile websites currently using
semi-colons in their viewport tag:

ebay.com, microsoft.com, m.flickr.com, cnn.com, espn.com, cnet.com,
nytimes.com, stackoverflow.com, i.reddit.com, stumbleupon.com, weather.com,
bankofamerica.com, myspace.com, deviantart.com, accounts.google.com,
skype.com, mashable.com, foxnews.com, guardian.co.uk, yelp.com, reuters.com,
telegraph.co.uk, m.booking.com, m.ups.com, forbes.com, washingtonpost.com,
bloomberg.com, samsung.com, pandora.com, mlb.com, cbssports.com,
usatoday.com, abcnews.go.com/m/

I've attached a CSV file listing each of their viewport tags, when accessed
with the following user agent: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-gb;
Nexus S Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0
Mobile Safari/533.1".

Most of these sites still happen to work in browsers which don't support
semi-colons (in particular WebKit uses strtod to discard trailing garbage
from numeric values, though that will skip all remaining properties if they
aren't separated by spaces, and it also  doesn't help for keywords such as
"device-width"). But it would clearly be better to parse the viewport as the
author intended rather than partially supporting semi-colons as currently
happens and allowing them to work by coincidence/redundancy (with surprising
effects for authors if they make minor changes like adding/removing
whitespace, adding/removing a trailing semi-colon, or even re-ordering the
viewport properties).

Despite adding semi-colons to the parsing algorithm, the spec should
probably still recommend that authors use commas rather than semi-colons - a
case of "Be liberal in what you accept, and conservative in what you send."

John

On Fri, Oct 21, 2011 at 12:36 PM, Peter Beverloo <beverloo@google.com>wrote:

> On Fri, Oct 21, 2011 at 11:48 AM, Kenneth Rohde Christiansen
> <kenneth.christiansen@gmail.com> wrote:
> > The ; was basically widespread by Android but I have been told that to
> > follow Safari, they removed their support for it, which let us to do
> > the same for our N9 browser.
>
> While I'm aware of this, the Android Browser has supported this long
> enough to create a wide-spread adoption among authors. As a result of
> this, there are compatibility issues created by the -now- lack of
> support for the separator, which is why I proposed the spec change.
>
> Peter
>
> > Kenneth
> >
> > On Fri, Oct 21, 2011 at 12:35 PM, Peter Beverloo <beverloo@google.com>
> wrote:
> >> On Fri, Oct 21, 2011 at 10:14 AM, Rune Lillesveen <rune@opera.com>
> wrote:
> >>> On Thu, 20 Oct 2011 19:12:01 +0200, Peter Beverloo <
> beverloo@google.com>
> >>> wrote:
> >>>
> >>>> The CSS Device Adapt specification defines a parsing algorithm[1] for
> >>>> the meta-element viewport content, which has been based on WebKit's
> >>>> implementation that shipped with iOS4. This algorithm only accepts
> >>>> commas as separators between properties.
> >>>
> >>> First, it's in a non-normative section, and we want UAs to move towards
> an
> >>> @viewport implementation. That being said, it's there to suggest a
> mapping
> >>> between viewport meta and @viewport in a transition phase.
> >>>
> >>>> In reality, web authors are using both commas as semi-colons. A wide
> >>>> range of websites, including CNN[2], Flickr[3] and Reddit[4] depend on
> >>>> this behavior, which has led at least Mozilla and Microsoft to
> >>>> implement it and, in case of the latter, write about it[5].
> >>>
> >>> Yes, and they have to add some combination of scale properties to
> compensate
> >>> for the fact that "width=device-width;" is the same as "width=0" in
> Safari
> >>> and Opera (see comments for the mentioned sites below).
> >>
> >> The fact that the numeric properties' values are being recognized are
> >> purely a work-around, which, in case of WebKit-based browsers, depends
> >> on disregarding trailing garbage for numeric values to parse these
> >> correctly (warnings for which are being shown in Web Inspector).
> >>
> >>>> I think the specification should adapt to reflect what authors are
> >>>> doing. While it's unfortunate that the divergence between commas and
> >>>> semi-colons happened, it's important for compatibility among mobile
> >>>> browsers.
> >>>
> >>> Two alternative proposed changes:
> >>>
> >>> 1. Keep the algorithm as it is and mention that some implementations
> accept
> >>> ';' as a separator in addition to ','.
> >>>
> >>> 2. Modify the algorithm to include ';' as a separator and say that it's
> >>> based on the Safari implementation with the ';' added as a recognized
> >>> separator.
> >>
> >> Your second alternative proposal describes the change I'm proposing,
> >> with the addition of a note saying that it differs there from Safari's
> >> implementation.
> >>
> >>>> [1] http://dev.w3.org/csswg/css-device-adapt/#parsing-algorithm
> >>>> [2] http://m.cnn.com
> >>>
> >>> Does not give me a viewport meta in Opera.
> >>
> >> I verified that they do give a viewport meta in WebKit, so they
> >> probably are sniffing for the browser. For reference:
> >>
> >> <meta xmlns="http://www.w3.org/1999/xhtml"
> >>      name="viewport"
> >>      content="initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
> >>
> >>>> [3] http://m.flickr.com
> >>>
> >>> "width=device-width; initial-scale=1.0; maximum-scale=1.0;
> user-scalable=0;"
> >>>
> >>> Works in Safari because the over-constraining scale values cause the
> width
> >>> to end up at device-width anyway. This would not have worked in Safari
> or
> >>> Opera: "width=device-width; user-scalable=0;".
> >>
> >> As said, this is because strtod() accepts trailing garbage, which
> >> applies to the numeric values. I don't expect authors to know about
> >> this difference.
> >>
> >> Peter
> >>
> >>>> [4] http://www.reddit.com/.compact (or http://m.reddit.com/)
> >>>
> >>> Same as for m.flickr.com.
> >>>
> >>>> [5]
> >>>>
> http://blogs.msdn.com/b/iemobile/archive/2010/11/22/the-ie-mobile-viewport-on-windows-phone-7.aspx
> >>>
> >>> --
> >>> Rune Lillesveen
> >>> Layout Group Manager
> >>> Core Technology Department
> >>> Opera Software ASA
> >>>
> >>
> >>
> >>
> >> --
> >> Peter Beverloo | Software Engineer | beverloo@google.com |
> +31-6-41000722
> >>
> >>
> >
> >
> >
> > --
> > Kenneth Rohde Christiansen
> > Senior Engineer
> > Application and Service Frameworks, Nokia Danmark A/S
> > Phone  +45 4093 0598 / E-mail kenneth.christiansen at gmail.com
> >
> > http://codeposts.blogspot.com ﹆﹆﹆
> >
>
>

Received on Saturday, 22 October 2011 13:44:36 UTC