"Writing the code that way is not only good for code completion/
suggestion but also good for syntax checking"

But it's also bad to repeat code which results in more "weight"....
which is exactly why code like that is written like so....  and
people's need for speed is going to far outweight your need for
IntelliJ's intellisense to work...  not that i have one ounce of say
in that, but after being on this Google Group for a while now, the
"core" of jQuery is all about optimized base functionality (which the
above code example does, as it takes care of two functions with one
set of code) and lowest kb's possible (which not repeating code
certainly helps!!)

You could make your own functions that *will* show up in Intellisense
but call the base functions, for instance... and note i have never
done this myself, but i know it's possible:

small and quick example:

http://jsbin.com/ujiru (run)
http://jsbin.com/ujiru/edit (code)

and then your text editor should pick up "your" version of innerWidth
and show it intellisense style, all without touching the core (or
increasing it's size!)  :-)


On Dec 29, 11:54 am, Thai Dang Vu <tdan...@gmail.com> wrote:
> Thanks Scott for a reply. Is there any other place where I can talk to the
> jQuery team and hopefully persuade them to write this wonderful library in
> that "regular" way? Writing the code that way is not only good for code
> completion/suggestion but also good for syntax checking (esp. with a tool
> like Idea).
>
> On Mon, Dec 28, 2009 at 3:26 PM, Scott Sauyet <scott.sau...@gmail.com>wrote:
>
> > On Dec 28, 2:55 pm, Thai Dang Vu <tdan...@gmail.com> wrote:
> > > I'm using IntelliJ Idea 9.0 which supports code completion/suggestion for
> > > javascript. It doesn't work with the innerHeight/Width because of this
>
> > >         jQuery.fn["inner" + name] = function(){ // [ ... ]
>
> > > Is there anyway to implement the innerHeight and innerWidth in a regular
> > > way?
>
> > Of course it could be done in the "regular" way.  But this is a means
> > to keep the download size of the library small.  There are numerous
> > places in the codebase where similar tricks are employed.  One
> > consistent goal of the jQuery team has been to keep the library as
> > lean as possible, and such tricks help, with practically no
> > performance cost.
>
> > I believe it would take a great deal of persuasion to convince the
> > team that supporting code completion in this way is worth the
> > additional weight of the download, but feel free to try... :-)
>
> >  -- Scott

Reply via email to