jQuery Lint

  • Thread starter Michael Haufe (\TNO\)
  • Start date
S

Scott Sauyet


Definitely flamebait! :)
A not so subtle hint that something might be wrong with your library?

It seems to be a tool to help new users learn things like that
although this code is legal:

$("selector").css("color", "red").css("margin", 0);

This would be more efficient:

$("selector").css({color: "red", margin: 0});

That doesn't indicate anything wrong with the library any more than
any lint program indicates problems with its target environment.

-- Scott
 
D

David Mark

<flamebait>http://james.padolsey.com/javascript/jquery-lint/
</flamebait>

A not so subtle hint that something might be wrong with your library?

Well, sort of. It's not so much the Johnny-come-lastly advisor plug-
in, but the fact that it is just another horrible plug-in for an
equally bad pile of JS. Anyone who would use jQuery enough to want to
write a plug-in is not going to be the best candidate to wtite a
browser scripting "lint." I can't see it.

The idea (which is sound) is to warn developers when they are doing
something incorrect (or ill-advised). I haven't looked at the code
for it (and I'm sure I never will). I find I don't have to do that
anymore as the basic rules always apply. :)
 
D

David Mark

Definitely flamebait! :)


It seems to be a tool to help new users learn things like that
although this code is legal:

$("selector").css("color", "red").css("margin", 0);

This would be more efficient:

$("selector").css({color: "red", margin: 0});

Except that neither result will be efficient in any sense of the
word. Such "optimization" of jQuery code is a fool's errand. You
dump it and replace it with something better (and faster). In this
case, something like:

el.style.color = "red";
el.style.margin = '0';

That's smaller, faster, more readable, makes no function calls,
creates no new objects and is impervious to upgrades to jQuery
(typically poison). And, as we all know, jQuery doesn't work worth a
shit anyway as the "logic" in the script is mostly a diary of confused
browser watchers. Get the picture?
That doesn't indicate anything wrong with the library any more than
any lint program indicates problems with its target environment.

Of course, you don't need a lint to see what is wrong with the
library. It's as obviously unsuitable as a dissertation written in
crayon.
 
S

Scott Sauyet

Of course, you don't need a lint to see what is wrong with the
library.  

As said, the post was definitely flamebait! :)

It's as obviously unsuitable as a dissertation written in crayon.

:)

I met someone who did that. Literally. Or so she claimed. Of course
her paper was on how to creatively integrate art education into pre-
school and Kindergarten programs. It was filled with many colorful
illustrations. Her adviser loved it, and so did most of the
committee. But she did eventually have to submit a more formal
version. So much for creativity!

-- Scott
 
D

David Mark

As said, the post was definitely flamebait! :)

Yes, truth in labeling here.
:)

I met someone who did that. Literally. Or so she claimed. Of course
her paper was on how to creatively integrate art education into pre-
school and Kindergarten programs. It was filled with many colorful
illustrations. Her adviser loved it, and so did most of the
committee. But she did eventually have to submit a more formal
version. So much for creativity!

It has its place.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top