- From: François REMY <fremycompany_pub@yahoo.fr>
- Date: Fri, 3 Aug 2012 18:08:17 +0200
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: "Florian Rivoal" <florianr@opera.com>, <www-style@w3.org>
The eternal debate between short names and naming conventions =D I've always been a Windows guy, I can't bear ambigous names for the sake of brievty (PHP's strstr anyone?). As it's actually a matter of taste, I will not fuel this debate anymore after this mail: I'll let you do a poll during your next telcon instead ^^ BTW, I initially had a CSSDeclaration{property as string, value as string} interface in mind as host for the 'isValid' function (not CSSStyleDeclaration) but it seems this is a creation of my imagination as it nowhere to be seen (CSSStyleDeclaration..item returns a DOMString, and CSSStyleDeclaration..declarations don't exist). However it's a fact that, even in that case, 'CSSDeclaration.isValid("","")' is 29 chars long while 'CSS.supports("","")' is only 20. An additionnal element to factor in is that most feature detection logic will probably happen in a specific module where you can use a scoped short name for the function (and should for perf reasons). -----Message d'origine----- From: Tab Atkins Jr. Sent: Friday, August 03, 2012 5:32 PM To: François REMY Cc: Florian Rivoal ; www-style@w3.org Subject: Re: [css3-conditional] navigator.supportsCSS rather than window.supportsCSS 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 16:08:38 UTC