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

On Fri, Aug 3, 2012 at 8:19 AM, Fran├žois REMY <> 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.


Received on Friday, 3 August 2012 15:33:30 UTC