W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [css3-conditional] navigator.supportsCSS rather than window.supportsCSS

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 3 Aug 2012 08:32:24 -0700
Message-ID: <CAAWBYDBBuyLZHshF2zC2nMmzuQcbAyV+tEJ=1vUn_z4DaR-6nA@mail.gmail.com>
To: Fran├žois REMY <fremycompany_pub@yahoo.fr>
Cc: Florian Rivoal <florianr@opera.com>, www-style@w3.org
On Fri, Aug 3, 2012 at 8:19 AM, Fran├žois REMY <fremycompany_pub@yahoo.fr> wrote:
> |  I don't think adding on to window is a big deal.  If we do want to
> |  avoid doing it, though, I suggest defining a new top-level interface
> |  named "CSS" and hanging it off of that.  It's short and topical, and
> |  it would be convenient for hanging some of the new css value
> |  constructors we'll want for the cssom values api.
>
> I'm afraid WebIDL doesn't support nested interfaces or namespaces right now.
>
> ##  For every interface that [should be available to JS] a
> ##  corresponding property MUST exist on the ECMAScript
> ##  global object. The name of the property is the identifier of
> ##  the interface, and its value is an object called the interface
> ##  object.

WebIDL can be improved; that happens constantly, and isn't an issue.

> BTW, CSSStyleDeclaration isn't that long to type.

CSSStyleDeclaration is *enormous*.  19 letters!  That's a full quarter
of your 80-char width gone immediately, not even counting the weight
of the rest of the declaration.
CSSStyleDeclaration.supportsCSS("","") is 38 characters of typing.
Considering how much we bitched over document.querySelector(""), which
is a mere 27 characters, 38 is horrible.  We *must* take these
ergonomic effects into account when developing APIs.

> Plus, remember, your IDE supports intellisense ^_^

"The tools will save us" isn't an argument.  Unneeded verbosity is a
bad thing no matter what.  Compare all that to something small like
CSS.supports("").  Now *that's* nice and tidy.  One character more
than the current function defined on window, but just as easy to read,
and allows for future expansion quite nicely.

~TJ
Received on Friday, 3 August 2012 15:33:30 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT