So, I happened upon an interesting thread this morning, concerning the recently released jQuery Lint. For those of you who have not dared to look, the comp.lang.javascript newsgroup is truly the proverbial dark alley of JavaScript and DOM development. I can picture it vividly, a dingy dusty cobbled walkway blackened by the thick fog of regressive opinion and unprovoked flame wars, riddled with the unquestioned prerequisite of a newsgroup’s slow death — spam on every corner!
If you have a read through that thread you’ll notice none other than the infamous David Mark. This is the same person that slammed jQuery (oh, and MooTools) for not being able to “do *anything* right” and then, not too long ago, threatened the jQuery project with legal action over some DOM attributes tests.
David had the following to say about jQuery Lint:
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 [he means jQuery]. 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.
He continues:
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.
![]()
David doesn’t stop! He still continues:
[Scott Sauyet]
> It seems to be a tool to help new users learn things like that although this code is legal:> This would be more efficient:$("selector").css("color", "red").css("margin", 0);[David Mark]$("selector").css({color: "red", margin: 0});
You dump it and replace it with something better (and faster). In this case, something like: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?el.style.color = "red"; el.style.margin = '0';
> 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.
According to David we should be sparing ourselves the obvious folly of abstraction and spend more time writing “smaller, faster, more readable” JavaScript:
// We say: $('#elem').css({ fontWeight: 700, width: 200, height: 100, color: '#000' }); // He says: var elem = document.getElementById('elem'); elem.style.fontWeight = '700'; elem.style.width = '200px'; elem.style.height = '100px'; elem.style.color = '#000';
David, if you’re reading this, maybe you could offer us a response, detailing why you think jQuery “doesn’t work worth a shit” and also perhaps you could enlighten us why verbose and old-fashioned DOM scripting is miles better than progressive abstractions like the one jQuery offers? And if not too much trouble, I would appreciate if you could spare us your slander and ad hominem.
And when I say “detailing why you think jQuery doesn’t work worth a shit” I don’t mean having a go at petty code inconsistencies and syntax peculiarities.
I hope this is just an exception and there’s actually some useful stuff there… Otherwise I don’t see why anyone would bother reading it.
Personally I wouldn’t even bother replying to such obious troll/flame.
@James & @Jani: David’s only reason for slamming other libraries is to be able to promote his own lib so take it with a grain of salt. And to be clear, he slams jQuery, MooTools, YUI, Dojo & Prototype but he has a very big hard-on for jQuery.
And as you correctly described James, CLJ is now a slum and not worth the time to participate in.
Why are you bothering with a guy like this? It’s clear he’s a troll, and should be paid no mind. I just refer to Katt Williams in these situations:
“You don’t have to wait to laugh at the hater. The Hater IS the joke!”
If he made substantive comments I could totally understand you engaging with him, but he’s too lazy to even examine your code. I would recommend ignoring these kinds of lame trolls, and using your time to enjoy life =)
changing multiple css properties one after the other is not fast, as it will trigger multiple reflows. cssText is preferable – and smaller.
So apparently david mark is not proposing the smallest and fastest solution. Having a glance at jquery’s source, it seems that jquery could be improved using cssText.
http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/
Obvious troll is obvious.
Obligatory: http://davidmissedthemark.com/
Yeah, I’ve actually unsubscribed from comp.lang.javascript because of his crap.
What can’t be denied is that MooTools, jQuery, Dojo, etc. are all working, working damn well, and have bright futures. His “framework” isn’t in the same class and his jealousy couldn’t be more apparent.
It’s a shame he doesn’t spend his time submitting patches, enhancements, etc. instead of shamefully insulting each framework.
Just ignore it, he is an attention whore.
We say “do not feed the troll”. It’s worthless
LOL…
eventhough i’m not using jQuery nor know anything about David, I’d say he has good intentions.
Writing code using a library blindly, is dangerous – especially if the library isn’t carefully made with speed in mind.
I learned a whole lot when i made my Editor: http://mdk-photo.com/Editor
what i learned was that Javascript requires very careful programming in EVERY cornor – small mistakes inside a loop, will cause the WHOLE code to suffer.
so – listen a little to the man, don’t shoot him down just because you LOOOVE jQuery
Erm, excuse me, but what about:
var elem=document.getElementById(‘elem’);with(elem.style){fontWeight=’700′;width=’200px’;height=’100px’;color=’#000′};
Why reinvent the wheel? BTW your precious jQ freezes my browser.
Oooo look at me, I’ve just written this amazing library that saves one micro-milli-nanosecond of performance. I’ll have to blog about that. It only works on certain ‘enlightened ‘ browsers though, but you’ll forgive me for that. Furthermore, it’s going to be adopted by all “cool” programmers, so if it dosen’t work for you then tougth shit. I recently heard Tony Blair use the proverbial ‘We’. I was just about as impressed with his rhetoric as I am about yours. I prefer to remain an un-cool neanderthal-a ‘He’. Bollocks, mate.
@eligmatic, what on earth are you talking about? I can’t even see what point you’re trying to make.
@Everyone, yeh I probably shouldn’t have bothered with this post at all… this troll’ish behaviour just really annoyed me. I’m okay with people not liking jQuery, but I really wish they’d articulate proper reasons as to why, instead of just tugging at the same chord, again and again!
@Martin, actually, I’d say his intentions are anything but good. As Rey mentioned, this guy is just trying to promote his own library. If you gave him the chance, he’d probably crap all over your code too.
Why invent a new syntax just for the sake of ‘elegance’. (X-hundred ‘bug’ reports later !==’progress’?). Forgive me, but what’s so shit-hot about using a library. I can create what I want when I want. A library is only a manipulation of the native code. So what’s so shit-hot about that?-EXCEPT THAT IT FREEZES MY F*IN BROWSER!!!
‘We’ and ‘He’ are semantic devices.
@eligmatic:
The with statement is dangerous, you cannot predict if the statements you use within will set properties of the object or create global variables. It’s a bug in the language and is removed in ECMAScript 5 strict mode.
And: jQuery supports browsers back to ie6. Which browser do you use that it breaks?
Last of all, why to use a library?: To write the same code for all browsers.
#eligmatic
the good thing about libraries, are that you develop faster (just look at .NET !!!! blazingly fast development + good performance)
Javascript is really a pain to write, when you make hardcore stuff – then you’ll spend a lot of time making your stuff work cross browser…
var d=document,jrersig=’can’t you see how credulous you are’;
@eligmatic, please provide test examples of instances when jQuery “freezes your browser”. This is so someone (possibly James Padolsey or anyone else for that matter) who knows jQuery very well can help locate the source of the problem and patch it or can explain the issue in more detail. If this issue is something you’ve noticed on other people’s websites who use jQuery then it would be silly to pronounce it the fault of jQuery as apposed to the developer of the site writing bad code whilst using jQuery. Either way some examples would be useful.
Okay, My problen is (my experience is) visiting sites I KNOW are JQ. I’ll give you a list in the nr future. New revelations-I’m using a MOBILE browser (Opera 8.65 moz4 ie6 compat). The more jQ becomes the norm, then the more shit I see. It’s the handlers in the page I think.
@eligmatic: Mark hit it on the head. Simply saying the jQuery freezes your browser with no context really isn’t helpful. If you can dupe the issue or provide a reference for us to look at, we’ll gladly see what’s causing the problems & do our best to resolve it. You can file a bug on the jQuery bug tracker here: http://dev.jquery.com/
Lastly, you should at the very least consider chatting with John Resig before painting him in a negative light. He’s actually a really great guy, very approachable and certainly interested in listening to new ideas. You may not like libraries, which is perfectly fine, but that doesn’t mean that you should instantly write off a person.
Unless of course you’re actually David Mark which would make this whole thing irrelevant since he seems to have a disdain for any code not created by himself.
mcDonnel. I’ll get back soon.
Wow, I’m certainly out-gunned here. My gripe is that in the sites I visit jQ ‘SEEMS’ to be a mega hindrance. I’m confident I have a good understanding of js. My experience tells me that the page is too busy-event handlers(something conflicts somewhere). I have tools to ‘deconstruct’ a page so I’m confident this is the culprit. Check out stackoverflow.com for instance.
@eligmatic: It’s not a matter of being outnumbered. It seems people here have a genuine desire to understand your concerns and maybe solve them. Without context though, it’s hard for us to understand issues we’re not experiencing.
You mentioned Stack Overflow for example, a site I visit often. I’ve never had my browser freeze on that site. To be certain, I just went to it again using Firefox, Chrome & Safari with no freezing experienced.
I genuinely believe you may have experienced something, otherwise you wouldn’t be concerned about it. Having something reproducible will be the key to resolving it. Please try to duplicate it and file a bug report via the link I gave you. We’ll be happy to help.
Re:a chat with jr. I already had that privilege. So I know he’s a top guy. Thank you.
@eligmatic, I must admit it’s a shame that you are feeling ‘out-gunned’ as for me personally (and I’m sure for others here too) it would be a great opportunity to get some specific data from you to help pinpoint the code related issues you’ve experienced when viewing a site that uses jQuery.
I’m sure though that you can appreciate the concern most people have when it comes to statements of this nature, in that people can’t just go about saying whatever they like without first running tests and making sure that what they are saying is in fact a valid statement (this goes back to my asking for any examples). It’s a sweeping generalisation to say ‘x’ library is the problem when in fact if the issue is with how event handlers are applied then that would suggest a possible issue with how the developer has constructed their code rather than a particular library itself (but as I say, without any empirical data collected it’s difficult to comment to that degree).
With regards to your suggesting we check out stackoverflow.com I can only say that in my experience using that site I’ve never noticed any issues (maybe someone else here can elaborate on any problems they have experienced).
Regardless of what anyone else thinks, I thank you for sharing your opinions as it help those who work with/on jQuery to fine tune it (if indeed it is necessary to do so in this instance).
@Mark: Thanks for the support. I’m a member of the jQuery project team and I’m certainly interested in his issues. If he can reproduce them, we can work to fix them.
Okay, so when I invoke my dellicious bokmarklet (stackov.com) why does the browser freeze?
@eligmatic: Not sure what stackov.com is. It’s not a valid domain. Do you mean that you have a Stack Overflow URL bookmarked via Delicious and when you try to open it via the Delicious bookmarklet, it hangs? If so, what is the URL that you’ve saved? If you access that URL directly, does your browser freeze or does it solely hang when you use the Delicious bookmarklet?
Let’s try to narrow the issue down as much as possible.
Thanks.
James et al,
David Mark is undoubtedly rude and frequently obnoxious, but it’s unwise to dismiss his views entirely, since he definitely does know his stuff. I don’t know about his motivations: he has repeatedly claimed that he doesn’t approve of large general-purpose JavaScript libraries yet has written one of his own that after two years of neglect he has recently started to push. His intentions for his library are unclear, but if nothing else, it lends some credibility to his claims about his own ability.
His anti-jQuery tirades are wearing, but there’s plenty of valid criticisms in there. He would stand more chance of persuading people if he could condense his thoughts on the subject into something concise, well-formatted and neutrally worded, because wading through all his jQuery-related posts on comp.lang.javascript is not a pleasant prospect and someone with only a passing interest is never going to do that.
Finally, I would really recommend sticking with CLJ. It’s far from cosy, especially for jQuery advocates, but get past the abrasive tone and the and you’ll find there’s some seriously knowledgeable people on there. I’ve learned a great deal from it about the language, scripting for browsers and the art of expressing myself precisely when talking about programming.
@Tim: Thanks for the comments. I have no doubt that CLJ has some smart people on there but unfortunately it’s spiraled into an absolute quagmire of vitriol commentary and I find no value in it at this point. There are plenty of other places on the Internet that can offer excellent and professionally delivered feedback and mentoring that dealing with the nastiness in CLJ isn’t worth the effort.
As for David, while he may know his stuff, there are entirely too many other people who are equally as talented and far more professional to put up with his nonsense. Nobody should have to be subjected to his nasty remarks in order to learn a language when there are others who are genuinely interested in helping people improve and are able to do so in a way that is not rude or offensive.
I commend you for your level of tolerance.
Rey,
Fair enough. There’s something about the abrasiveness of CLJ that I positively like: it’s encouraged me to raise my own level in a way that a softer forum wouldn’t, but I do spend a lot of time filtering out the tedious stuff. Out of interest, where else would you suggest going for a similar level of smart people discussing JavaScript-related things?
@Tim: I tend to chat w/ a number of really smart people directly but I’ve also found that the Dojo mailing list, StackOverflow.com & even SitePoint have really experienced developers who can help solve most any questions.
I wandered over to comp.lang.javascript the other day figuring it’d be another useful source to fuel my increasing interest in the language. After clicking through a few threads I ran into one of David Mark’s tirades (it’s not hard as they tend to draw the most responses). This specific thread attacked jQuery, Prototype and probably a couple other popular libraries. What struck me most about his posts, over any specific point he was trying to make, was his tone. Specifically the vitriol with which he attacks not only jQuery/Prototype/whatever, but also its authors (he makes a point to call Resig out by name). Whatever technical points he’s making are almost completely lost as he reels off jabs and insults that attack not just technology but the people behind the technology.
I’m not new to the Internet so I’m all too familiar with flame-wars and trolls, but I have to admit I was unsettled by the venom being spewed. I’m guessing I probably won’t return to CLJ often and instead will opt for for civilized, constructive forums (like this, for example). It’s sad that 1 person can have such a dramatic effect on a community, especially when it appears he does have a high level of technical expertise.
Maybe I’m compounding the felony but-for what it’s worth. if I’m right(I sometimes am) then because jQ relies heavily upon chaining, then to a mobile device (a tiny processor) this means ‘brain-fuck’-freeze. No wonder I’m in shit alley. Discuss.
“I’m sure though that you can appreciate the concern most people have when it comes to statements of this nature, in that people can’t just go about” writing liararies however they like without first running tests and making sure that what they are doing does not FUCK UP MY BROWSER!!!
@eligmatic Nice twist
but I’m afraid that’s not exactly helping your situation.
Think about it, jQuery will continue to be used by developers, so your best bet is to try and help them help you.
Go onto the jQuery forums, or contact John Resig directly (e.g. via Twitter or whatever means you know of) and explain what the issue is and see if there is anything they can do. They may not be able to change their code base, but they could change the way developers write their code so it doesn’t cause these types of mobile issues.
Originally all you told us was that “IT FREEZES MY F*IN BROWSER”. But now you’ve helped by clarifying further that the issue ‘appears’ to be related to the fact that jQuery relies on ‘chaining’. Now I’m not sure if this is definitely the issue, but you’ve got a member of the jQuery project team here on this thread who has already expressed his interest in helping you so I’m sure he’ll take a look for you and let you know.
Thanks eligmatic for clarifying.
Kind regards,
M.
Probably David Mark didn’t start Javascript coding when I started in 1998. It was horrible those days. No good libraries, no good debugging tools, nothing. document.all & document.layers would make life a hell. There were mainly two beasts- IE4 and Netscape(3 & 4). I dare someone to write a cross browser code without any library for those. It’s easy to say “jQuery is worth nothing”,”write something smaller,better”- these craps, only because you haven’t faced those days.
jQuery (and some other libs) is a blessing for new JS programmers. Of course those who wants to digg deeper, they must know the core very very well. But what percentage of developers are there of these sorts ? The vast majority would like to get the most output with minimum effort. And these days, PCs are faster enough to take the loads of an extra library.
I’ve never heard of this David Mark fella, so I Googled him and found his library page. He says:
“My Library works in browsers that do not yet exist. Furthermore, it works in theoretical browsers that may never exist.”
I don’t know enough about JS to know why he would even say that. I suppose it could be based on proposed changes in ECMAScript, but I really don’t see how he could prove such a thing, why it would matter, or why anyone would believe it.
Louis,
I believe that’s a dig at jQuery, which had some issues when IE 8 came out, and David Mark believes his library is better equipped to deal with new browsers because all his code is built on (sometimes quite involved) feature detection.
Tim
@Louis
This is probably a reference to the issue of browser sniffing. jQuery *was* relying internally on browser sniffing. It is not the case anymore, jQuery does now feature test.
Yeah, purist favor feature test over browser sniffing. it is true that browser sniffing has been abused by js developers, and in many cases for things where feature test was applicable.
However, in many other cases, feature test can be costly performance-wise or impossible.
For instance, some browser do implement certain features, but in a broken way. They do require then a test of the feature, and then a test to know if the feature is broken.
In some other cases, a developer would like to target a specific behaviour, which is not a feature. For instance memory leaks. AFAIK You cant feature test a memory leak.
#olivvv
… And thats why i program Silverlight… rather then JS…
@martin kirk
You still have to feature test silverlight then, if you want unobtrusivity and graceful degradation…
#olivvv
LoL… no…
simply request that the client supports version x.y.z.w then you are good to go…
no troubles
@martin kirk
if (client supports version x.y.z.w){
//then you are good to go…
}
else{
//nothing, obtrusive behavior
}
@olivvv
if (client supports version x.y.z.w){
//then you are good to go…
}
else{
ForceClientToUpdateSilverlight();
}
@olivvv
if (client supports version x.y.z.w){
//then you are good to go…
//no hazzle about what browser is visiting
//95% of all computers are support (Linux/Unix are not)
//smooth sailing…
}
else{
ForceClientToUpdateSilverlight(); //which shouldn’t be necessary because Microsoft pushes updates in the Windows Update…
}
@martin kirk
if (client supports version x.y.z.w){
//then you are good to go…
//no hazzle about what browser is visiting
//95% of all computers are support (Linux/Unix are not)
//smooth sailing…
}
else if (ForceClientToUpdateSilverlight){ //feature detection
ForceClientToUpdateSilverlight(); //which shouldn’t be necessary because Microsoft pushes updates in the Windows Update…
}else{
//welcome in the non-open web, you are stuck at this point
}
@olivvv
LOL…
it’s only Mobile clients and Linux/Unix users who will experience a site not availble — but i don’t see the difference between a Flash homepage and a Silverlight homepage… heck – even Javascript heavy sites are unavailable (or hard to use) on Mobile clients
Silverlight/Flash isn’t closing the web – especially not when 95% of all clients are able to access the site…
you have no argument.
@martin kirk
I think I do have an argument, and I’m not alone with this. It is called unobtrusive design. A javascript heavy homepage properly designed should be accessible to users with no javascript. just google that for more information “unobtrusive javascript”.
Silverlight/Flash are proprietary technologies, even if 95% of the users have it. Accessibility is about 100%. Think of search engine spiders, screen readers, etc..
That’s the reason why many frontend devs stick to javascript even if flash/silverlight may have superior features/performances in certain cases.
Accessibility, open web. That’s not something that Silverlight/Flash can claim.
@olivvv
Well – i guess it all depends on what kind of homepage you are building…
The place im working, only produce Silverlight sites – but these sites are business only… which makes the platform very appropriate !
if you are building social sites or news sites – then HTML/JS is a better choice due to accessibility and index’ability as you mentioned. (i agree 100% in this case)
The reason why i like Silverlight so much, is mainly because i enjoy making interactive sites, rather then common text-sharing sites…
designing and animating a site using Silverlight is so much easier then JS.
SL wins over JS hands down when it comes to cross-browser looks’n'feels – you simply make it like you want – and every visitor experience the same thing.
so in all – the technology depends on the purpose of the site you are building.
I’ve got a hard on for Jquery as well. My API is much better, I now look at anyone who uses Jquery in the same condescending manner as I do proud mac users. Really now.. best what? It’s popular, I’ll give it that, but just like Flash, all it did was encourage sloppy web developers to get sloppier. My API well.. I should probably stop there, because if i had more time to test, I’d be bashing Jquery alot more often. The only reason I’m here is because I’m trying to do a simple animation loop, but apparently Jquery thinks I’m being unreasonable.
protip: the link is my api, being used for practical nonsense. I’d release documentation if I had it.
@eligmatic
“Why invent a new syntax just for the sake of ‘elegance’.”
Sure…why did we invent C! oh my god how foolish we are! we should be programming in assembler!!
/sarcasm
@James
I’m totally with you on this…you can not like a library, but you can’t just bash it with any sad excuse you find. Or compare your own “super library” with jQuery when your library has 1/20 of the power jQuery (or other similar lib like mootools) has….it’s plain stupid…
Rey Bango is a jQuery shill. jQuery is junk and I’ve been saying that long before I promoted a GP library. Furthermore, jQuery (and Prototype and the rest of the “majors”) have been _heavily_ influenced by the patterns popularized in My Library (e.g. see Resig’s “sudden” revelations about his browser sniffing foibles a year after I published it). Ironic that these same people would be my harshest “critics”, but perhaps they want to draw attention away from the fact that they are epic failures and easily a half-decade behind the “cutting edge” of browser scripting.
Resig and some of his followers practically begged me to enlighten them on cross-browser scripting back in 2007. They also suggested that my criticism of jQuery couldn’t be valid as I hadn’t published a “cool” cross-browser library (neither had they of course and they still haven’t).
After publishing My Library and watching it handle new browsers for years with virtually no modification, while others were frantically scrambling to support IE8 (and threatening to “deprecate” IE < 8, which is laughable as IE8 can act just like IE7 with the click of a button), I decided enough is enough.
And, of course, as predicted, the brain cell-challenged jQuery shills of the world changed their tune to "aw, UR just jealous coz nobody uses your library."
And that idiotic tribute page has been thoroughly de-bunked in this thread:-
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/910da4771b1fc832/f61c683fa1bb3269
…and continuing here:-
http://www.google.com/url?sa=D&q=http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/7ee2e996c3fe952b%23msg_b16895423bcb4731&usg=AFQjCNFeTLo4Hyrz6uBoKoBSM-J587wj3g
Synopsis: you don't compare apples to oranges, anything based on queries should be avoided and the "major" libraries were stupid to pounce on QSA when they hadn't even finished what was on their collective plates (e.g. DOM traversal). On that last bit, I see some of them now trying to "normalize" QSA to work more like their incorrect "slow lanes". LOL. Programming by observation doesn't work (sure as hell not in browser scripting). You've really got to have _some_ understanding of how the browsers work.
Why does jQuery suck? Can't say for sure. Incompetence? Ignorance? A combination thereof. Certainly the design was botched from the start, but that's what you would expect from a JS neophyte. Just because Resig wrote a (much maligned) book called "Pro JavaScript Techniques" (when he was not a professional at all at the time) does not mean he actually has any sound JS techniques to offer (quite the contrary).
My reviews of it (and things like it) are a matter of public record. And posting them to a technical newsgroup cannot be considered "trolling" in any sense of the word. If you have a problem with any of them, I suggest you post a rebuttal. There's been very little in the way of refutation over the years, but a major surplus of shrill bleating and whining.
If you want to know the details, search the CLJ archive starting back around October of 2007. Note that I did try to help Resig, but he couldn't seem to grasp a thing I was saying (though the bit about browser sniffing did finally sink in apparently). Their biggest shame, which they share with all of the "majors" is that they can't even read or write attributes straight. How is it progress to foul up a crucial low-level DOM operation like that? To this day, they haven't done anything to fix it (but have wasted tons of time discussing it to no end).
And, for those who are new to this industry, of course I have contributed to some of these projects (practically rewriting Dojo at one point, but that's another story). Also gave Resig the answer to the attribute question in late 2007. He didn't get it then and when he tried to copy a related, copyrighted work of mine in 2010, I responded appropriately. It's just not my job to continually teach browser scripting to John Resig or to donate everything I write so that he can foul it up in jQuery (he can't copy as he doesn't understand what he is copying).
It's always been stupid to use a library that must be rewritten every few months just to "support" three or four browsers in their default configurations (and break everything else in unpredictable ways). That's _not_ cross-browser scripting, but it is very aggravating to your users, as well as expensive (assuming you bother with trivialities like regression testing). It was stupid in 2001 and is beyond ludicrous in 2010.
http://www.jibbering.com/faq/faq_notes/not_browser_detect.html
So to sum up, My Library has been shown to be _much_ faster (even exponentially in some browsers) than jQuery (and the rest) for queries and basic DOM operations. Try it yourself.
The OO interface is a far better design as it doesn't use a $ factory for everything, but an appropriate set of constructors, which allows the leveraging of Javascript's prototypal inheritance.
Compatibility isn't even a horse race. See discussions here:-
http://groups.google.com/group/my-library-general-discussion/
…and realize that jQuery is a long way from being compatible with any version of IE (for one, due to the ridiculous attribute issues, which has been discussed to death in CLJ).
Support is far better as questions are answered by people who actually understand the code and browser scripting in general. The jQuery support forum is an exercise in futility (the blind leading the blind). This has also been discussed to death in CLJ (roughly 25% of questions get no answer at all!)
And it is free now, rather than a loss-leader for my consulting business, so there's certainly no reason to stick with a proven loser like jQuery. How many years (and mandatory, incompatible "upgrades") does it take before you stop listening to know-nothing salesmen like Rey Bango? He's trying to sell dubious books (which will likely be on the bargain racks soon enough).
And one final note. The "argument" about C vs. assembly language is ludicrous. jQuery is just a silly (and error-prone) 70K script. Anyone steering the discussion down that road has no idea what they are talking about.
@Olivvv
“This is probably a reference to the issue of browser sniffing. jQuery *was* relying internally on browser sniffing. It is not the case anymore, jQuery does now feature test.”
Yes, I personally set Resig straight on that (among other things) two years ago.
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/415949d1bcce6e6a/03c4d326340e7f7d?#03c4d326340e7f7d
The code he announced a year later is virtually identical to the feature testing published in My Library (but botched a bit of course). They copied right down to the flaws just like a cargo cult.
“Yeah, purist favor feature test over browser sniffing. it is true that browser sniffing has been abused by js developers, and in many cases for things where feature test was applicable.”
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/777f7b35ff7ea7b7/c32f2870c74f346b?#c32f2870c74f346b
In short, you are conceding a point decided back at the turn of the century. The label “purist” is meaningless in this context.
“However, in many other cases, feature test can be costly performance-wise or impossible.”
That’s the typical generalization put forth in defense of browser sniffing. Also meaningless as it has no context.
“For instance, some browser do implement certain features, but in a broken way. They do require then a test of the feature, and then a test to know if the feature is broken.”
LOL.
In short, you are mistaking feature detection for feature testing. Feature testing browser quirks is one of the central themes of My Library. Look into it.
“In some other cases, a developer would like to target a specific behaviour, which is not a feature. For instance memory leaks. AFAIK You cant feature test a memory leak.”
No, you can’t feature test a memory leak. Most memory leaks are caused by circular references involving host objects. Here’s another ancient reference:-
http://www.jibbering.com/faq/faq_notes/closures.html#clMem
In short, such leaks can be avoided at design time, eliminating the need to “compensate” with non-solutions at run-time. Furthermore, there is more than one type of browser sniffing. Most of the “majors” have been content for years to branch on the meaningless UA string. That’s the lowest form (for reasons that should be obvious and were certainly driven home on the release of IE8).
I was certainly ready for IE8 (literally didn’t have to lift a finger), as were my clients. Were you or your designated go-to JS Ninjas? I think the answer is obvious. If not, visit any of their forums (particularly the development groups). And that’s just one (very popular and ostensibly supported) browser. What about all of the others that they arbitrarily break because they don’t want to write proper cross-browser scripts? I’ll say it again, it’s stupid to use such “tools”. Regression testing is expensive and best one _once_. Re-downloading new versions every six months, which are invariably incompatible enough to require expensive re-testing is folly. Anyone involved with Web development who can’t see _that_ is in the wrong business.
Nobody is saying to “re-invent the wheel” every time. What I am saying is that jQuery and the others are pretty shoddy wheels that often fall off.
All of my arguments are part of the public record (and not all reside in CLJ), so feel free to contradict them if you can (and refrain from mindless denigration of newsgroups while you are at it as it seriously undermines your credibility).
“IE4 and Netscape(3 & 4). I dare someone to write a cross browser code without any library for those”
Well, My Library is quite capable of running in those browsers (provided the build does not include the two modules that have try-catch clauses). In fact, even with try-catch it will degrade fine (albeit not in the classic “graceful” sense). It won’t blow up in your face and leave the document in an unexpected state. That’s the main point.
It prunes features from the API that are not workable. Which is a far cry from the norm of offering a static API that gives no indication at all of what will work and what will blow up unexpectedly.
http://groups.google.com/group/my-library-general-discussion/browse_thread/thread/b6ac06b4bb20768e#
That thread is related to NN3/4, with a working example of a script tested in NN4.
The point of testing in lots of old browsers is not to support those browsers but to expose holes in the feature testing and gaps in the degradation paths. It’s worked quite well for us. In contrast, the “majors’ seek to arbitrarily exclude such “unused” browsers as IE7 and Opera 9, which is ridiculous for scripts that claim to be cross-browser. The end-users don’t read the trades. They don’t care if some clueless developers decided their browsers (which they may well be powerless to upgrade–think corporate users) were “deprecated”. All they know is whether your page works or not. Make no mistake that if it does _not_, they will go across the street (unless you are lucky enough to have a monopoly). And they don’t want to hear about how Firefox is “free” either (again, they may have no choice in the matter whatsoever).
@James
“According to David we should be sparing ourselves the obvious folly of abstraction and spend more time writing “smaller, faster, more readable” JavaScript:”
I didn’t say anything like that. I offered a _general_ example of jQuery abatement. Of course you could abstract such a trivial example yourself. But be warned that calling functions in between setting styles will cause reflows.
Quoting you:
// We say: $('#elem').css({ fontWeight: 700, width: 200, height: 100, color: '#000' });// He says: var elem = document.getElementById('elem'); elem.style.fontWeight = '700'; elem.style.width = '200px'; elem.style.height = '100px'; elem.style.color = '#000';I don’t recall saying that at all.
But regardless, it is extremely naive of you to think that the jQuery version is superior because it has fewer characters. But then I read somewhere on here that you are in your late teens, which would have made you a toddler when I first took up browser scripting. Suffice to say that you have much to learn.
And from reading your front page, I see you are interested in progressive enhancement. You do realize that jQuery and the other “majors” designs preclude such a possibility entirely.
Here is a very basic example of progressive enhancement:-
http://www.hartkelaw.net/
You flat out cannot do that with jQuery. To be able to _progressively_ enhance a document, it is necessary to know the limitations of the given environment. JQuery presents the same static set of methods in every environment, so you are SOL. That’s where all of this talk of “supporting” just the latest browsers comes from. They can’t deal with anything they haven’t recently tested and so neither can their users (or their end-users, who are completely unaware of how they ended up with an unusable document).
I truly hope that makes sense to you. It’s the ballgame as far as cross-browser scripting goes. You can throw Hail Mary’s on every play and let the chips fall where they may or you can use a sensibly designed abstraction layer that enables a more diverse (and sensible) playbook.
@Mathias
“Obvious troll is obvious.”
You clearly don’t know what a troll is and are simply parroting others (who are likely similarly ignorant). If you don’t want to read CLJ, then don’t. Insulting people you don’t know because they disagree with you is juvenile.
@Olivvv
“changing multiple css properties one after the other is not fast, as it will trigger multiple reflows. cssText is preferable – and smaller.”
That’s not true. It is only on exiting an _execution context_ that such reflows come into play. That’s why I advised you not to call jQuery’s functions as they will call additional functions per style, which will indeed slow things down due to reflows and repaints.
“So apparently david mark is not proposing the smallest and fastest solution. Having a glance at jquery’s source, it seems that jquery could be improved using cssText.”
I didn’t propose the smallest and fastest solution, but then your “solution” stomps on any pre-existing inline styles, so isn’t relevant to the context.
@Brian
“If he made substantive comments I could totally understand you engaging with him, but he’s too lazy to even examine your code.”
I’ve made lots of substantive comments about jQuery’s code (as well as many others), both in and outside of CLJ. Clearly I’ve examined the code, so what are you trying to say?
“Okay, My problen is (my experience is) visiting sites I KNOW are JQ. I’ll give you a list in the nr future. New revelations-I’m using a MOBILE browser (Opera 8.65 moz4 ie6 compat). The more jQ becomes the norm, then the more shit I see. It’s the handlers in the page I think.”
You hit it right on the head. jQuery is stunningly inefficent JS. This point is well-documented. Run it through the various quasi-standard industry tests and that much is clear (though if you know JS, the results are easily predictable).
Worse still, the design encourages this ham-fisted approach:-
$('myid').addClass(...); ... $('myid').removeClass(...);The neophytes who use jQuery see the $ as meaning a variable. In reality, it creates and discards a monstrous jQuery object for each line like this. It’s beyond inefficient (more like insane).
So you are using a mobile version of Opera 8? For one, that will amplify the efficiency failings (same goes for any mobile device). For two, jQuery doesn’t even “support” that browser, which means they just let it break.
The response you got from their rep here is exactly the sort of “support” you can expect from people who don’t understand the inherent shortcomings of their own code. I don’t know why they didn’t just come out and say that jQuery is relatively sluggish and doesn’t support Opera 8. But then these people post _pictures_ of Usenet posts, rather than links, so that the curious cannot see the previous posts or (more importantly in this case), the follow-ups.
http://gyazo.com/872eaa93d50fa5c903b460f836ee0dbe.png
That’s beyond disingenuous (and so inept that it likely won’t help their case).
@eligmatic
“Wow, I’m certainly out-gunned here.”
There are a lot of jQuery fanatics out there. It smacks of a religious cult (and try arguing with cult members).
“My gripe is that in the sites I visit jQ ‘SEEMS’ to be a mega hindrance.”
In such cases, I’ve found that things are exactly as they seem. And yeah, it pisses me off too as I am constantly stumbling over incompetent scripts on the Web. It’s not always jQuery, of course, but being the most popular, it comes up more often than not.
“I’m confident I have a good understanding of js.”
That’s as maybe. You don’t need that to call a bad page a bad page. Most users don’t know (or care) what JS is.
“My experience tells me that the page is too busy-event handlers(something conflicts somewhere).”
jQuery’s design also encourages developers to attach listeners to query results en masse (e.g. 100 nodes, 100 listeners). This was pointed out to them numerous times over the years and they eventually added “support” for delegation, which is a fancy way of saying attach just one listener to a common ancestor (which you sure don’t need jQuery to do for you).
And I see you got a similar marketing-speak response from the jQuery rep. That’s all you will ever get out of them as they sure won’t admit that their script is a sputtering clunker of a design and its users don’t know what they are doing with it. That wouldn’t be good for book sales.
“I have tools to ‘deconstruct’ a page so I’m confident this is the culprit. Check out stackoverflow.com for instance.”
I’ve seen it.
It’s a classic example of a site that’s been jQueried to death. Dog-slow, twitchy, incompatible with anything but the latest desktop browsers in their default configurations, with default plug-ins installed and enabled, etc. It’s one of about a million at this point, but it’s the wave of the past. If we keep up like this, we’ll all be programming Flash.
Ah, so the lint thing is _yours_.
Granted, I didn’t look at it at the time as anything built on top of jQuery is going to inherit the problems of jQuery, so why bother? I already know about those problems and they are fatal to any cross-browser scripting effort. Don’t build castles in a swamp.
Looks quite similar in design to my own debugging facilities for My Library, but I’m sure that is a coincidence.
After a superficial look, at least it doesn’t seem to rely on jQuery for much. That at least gives it a chance of working. But of course, it isn’t useful without jQuery.
And BTW, any time you find yourself writing an isFunction or isArray function, don’t. Re-think your design at that point. And why are you using the “Miller device” (quotes indicate Miller didn’t invent it) for functions? Do you expect to pass host objects to isFunction? If not, just use typeof as there is no ambiguity for functions (as opposed to arrays). And I didn’t see where you even used isArray.
@David Mark
a quick question: Do you considder Douglas Crockford as a ‘hero’ or ’some-old-guy-who-participate-in-JS-development’
I’ve mentioned some oddities in his jslint – and his response was very pius… as if his idea of JS is the perfect one…
Crockford is a certified language expert. He’s certainly one of the best. He doesn’t seem to have much interest in cross-browser scripting though and has admitted that he made some mistakes regarding the OO end of it.
JSLint is _invaluable_. Use it (I certainly do). But yes, some of it is his own personal opinion and should be taken with a grain of salt.
@David Mark
“Most memory leaks are caused by circular references involving host objects”
But not all leaks. There is other cases that needs to be handled. And there is pretty much no documentation available about them.
… “go-to JS Ninjas” …
What are you referring to ?
“and refrain from mindless denigration of newsgroups while you are at it as it seriously undermines your credibility”
What ? Where ? When ? Me ?
I respect your expertise, David Mark, and I don’t mind your rough language, but that kind of insinuations is wrong and abusive, and draws the discussion away from web development.
I’m not one for mindless conflicts that resolve nothing, but now that David Mark has shared his side of the story I believe it would be a good time to have some others (possibly James Padolsey) to step in with some intelligent debate/responses.
From the sounds of David’s comments above he at least – in my mind – comes across as being open to some form of intelligent debate so I say give him the chance by offering constructive opinions and questions and start the back and forth communication which will hopefully provide a better understanding of his thought processes and see if there is indeed any validity to what he states.
This may seem like a lot of work to begin with, but I truly believe this would be a great time to bring some kind of closure to the ‘apparent’ *trolling* David Mark is accused of.
Let me make it clear that I’m a fan of jQuery and of James Padolsey and so I don’t wish to sound like I’m ‘calling out’ anyone specifically. Again, I’m not interested in anyone retaliating in any kind of agressive manner, I simply believe in a fair discussion.
So far on this thread David Mark has not come across as being ‘outrageous’ in any way. It’s obvious that he feels jQuery has areas of concern/issues and we need someone of considerable JavaScript skill to refute these claims with the relevant evidence or either accept his opinions until they can be sufficiently disproved.
Lets open up the communication…
Gosh, David, you seem quite the devious individual.
I have to say, your responses are almost civil, but don’t be mistaken; no amount of sugar-coated smiley-interlaced prose will make us forgot your frank and continued rude attitude and your slanderous tendencies. CLJ is open for all to see.
You may be technically sound in what you say but that doesn’t negate nor soften the obvious spite and bitterness with which you write. I don’t know what kind of person you are away from the keyboard, but I don’t think you’d get along with the rest of the people in your field, most of whom are forward-thinking and well behaved. Although, I dare say you should seriously take up Dalton’s suggestions and speak at one of the upcoming conferences, for I think it would offer you a bit of perspective, and perhaps a reality-check.
I may be young, and yes, I may have been a mere toddler when you first happened upon the world of browser scripting but what I don’t have in years, I have in respect. That’s respect for individuals, older or younger, that have knowledge, humility and at least some decorum; three qualities that you can’t seem to portray all at once.
@Olivvv
“Most memory leaks are caused by circular references involving host objects”
“But not all leaks. There is other cases that needs to be handled. And there is pretty much no documentation available about them.”
That’s 100% correct. But it doesn’t imply a need to sniff the UA string. That’s my main point.
Not to you in particular. Anyone using – jQuery – for example is putting (often blind) faith into a group of self-proclaimed JS Ninjas, MacGyers, whatever. The contract is that they know and do cross-browser scripting so well that you don’t have to worry about it. Nice thought, but in reality they know and do it so poorly that you have to download an irritatingly incompatible new version every six months, just to “support” the very latest desktop browsers and pretend all other agents have ceased to exist. The problem with that last bit is the users of other “non-supported” agents don’t know they don’t exist (some of them don’t know what a browser is.
No, not you. Blog comments just don’t work very well for discussions. That’s part of what has led to the general futility in this industry. Would be much better if people learned to use newsgroups, irritable inhabitants notwithstanding.
What insinuations? If you mean the appearance that I was specifically referring to your behavior or expertise, it was not intended.
@Mark McDonnell
Always welcomed. I think these blog comments are an irritatingly ineffective medium for disussions though.
Hey, nice attitude.
Trolling, sigh. Do you understand what that word means?
Software really shouldn’t have fans, but informed users. Fair discussion sounds fair to me.
We are beating a very dead horse here. All of the information is a matter of public record. Did you follow the links to the various debates on CLJ. Is there a problem reading them because you think some of the people are rude? Hold your nose and read them. They will lead to more as those few debates are the tip of a large iceberg. jQuery has been _proven_ dubious repeatedly over the years.
If you seek the opinion of someone of considerable JavaScript skill, you can start with mine.
You (collectively) seem somewhat familiar with my body of work on the subject. If you want a softer, more polite voice, try reading Richard Cornford’s posts on the subject. IIRC, he wrote the two (ancient) references I linked to on closures and browser detection.
Again, nice attitude, but you can find everything you really need to know in the CLJ archive. It is searchable after all. Well, sometimes. Google breaks that functionality occasionally.
Barring that, it is echoed all over the Web, so the standard Google search engine can also dig up the relevant articles. It shouldn’t take long to find a voice you can identify with. Then search for topics plus that author’s name. In this way, you don’t have to see possibly inflammatory follow-ups at all if you don’t want to.
In what way?
In what way did they fall short in the civility department? The whole post and previous discussion was fairly insulting to me after all. I didn’t have to respond at all, leaving you to whatever misconceptions you may have about jQuery and cross-browser scripting in general.
That’s your analysis. It’s not accurate, of course, but you aren’t alone in that misconception.
You don’t have any idea. And in what way do you find my thoughts backward? And would you prefer that I told you jQuery was great and don’t worry about it. That would be a disservice. You should try to appreciate that I took the time out to help you.
In what way would speaking at one of the upcoming conferences give me a “reality-check?” I think you are a bit out of touch with reality yourself.
Stick around a couple more decades. You might lose some of that wide-eyed optimism.
@David Mark
Hi David, in response to…
…sorry if I used the wrong terminology but as far as I was aware a ‘troll’ was…
“An individual who posts flames of an idiotic or pseudo-intellectual nature on public forums and private websites. Many of these people actually become emotional about what is said on the afore-said mediums and feel it is their duty to punish those who disagree with them. They too may pursue this object in an obsessive-compulsive manner”
…and as my only dealing with yourself has been via this site I had to prefix my response with the word ‘apparent’ as not to falsely label you (or confuse others by making that part of my response sound like I was stating a fact).
Again, if my understanding of what a ‘troll’ is is incorrect then it would be beneficial to myself and others if you clarified the real meaning of the word ‘trolling’ as I believe most people think a troll is how it has been described here.
@All
I think i know the situation of David…
He’s frustrated !
Frustrated because he sits on a mountain of knowledge and knows how Javascript should be written, he knows when its done wrong… He’s frustrated because he feels deeply for the language – and thinks that developers who use jQuery aren’t paying attention to its shortcomings (and lack of perfection).
I know how he feels – because i feel the same way about religious people. Being an Atheist (or Anti-Theist) – i’m frustrated about people not being able to see the obvious truth eg. the world being 4.6 billion years old for one thing…
so i guess the solution to this whole mess has to come from both sides:
- David should write blog entries on his own blog (if he has one) about all the problems and shortcomings of jQuery he finds
- People who use jQuery (and other libs) should read his blog
in this way, David doesn’t need to argue for his cause on ill-informed users blogs or in newsgroups or whatever… he should simply post a link to his blogposts about the current subject.
arguing about jQuery, is a too big and complex thing to boil down to simple responses on a comment… and thats why it becomes ‘personal’.
@Martin, his frustrations, while obvious, do not excuse his rudeness. If he wants people to listen to him then he’ll have to soften his attitude.
@James
exactly…
and to my early discovery of David not having a real homepage – i think he should promote his library more + make a real website/blog
I think it would solve most battles…
@Mark
I post JS code reviews (and help) to a technical group on Usenet, where such things are on-topic. That’s not flaming or trolling.
Now, this post on this site is definitely a flame. If you popped into CLJ and posted a link to it, you would be trolling. Of course, these are not hard and fast rules.
@Martin
No, as mentioned, I get frustrated when jQueried sites fall apart under my feet on the Web. That’s irritating.
Other than that, I am elated with the general incompetence of these open source JS libraries. It leads to a lot of work cleaning up broken sites, removing bad libraries, etc.
And it’s not just that jQuery is imperfect. It leaves years of futility in its wake. Read the reviews. Or, for a picture:-
http://www.cinsoft.net/mylib-testspeed.html
Now, the idea of a CSS selector query engine wasn’t necessarily bad. However, the execution over the years has been so abominable that even experts would (and do) shy away from needlessly over-complicating their applications with such nonsense. Try out the SlickSpeed test in just the very latest browsers (in their default configurations). Terrible. Now go back to the last (usually “deprecated” by the library developers, but not the end-users) version of each. Oh jeez. Once QSA support drops off, these things drop dead. It is _not_ “cool” to take something that is virtually fool-proof in (literally) all browsers (e.g. DOM traversal with standard host methods) and turn it into a complete catastrophe, even in the very latest browsers. Think about that.
And imagine a neophyte Web developer (the target demographic for jQuery) who wants to “just get things done” testing just the very latest “supported” browsers and asserting that he/she “doesn’t care” about the rest of the “unsupported” browsers (quotes indicate the jQuery developers have no idea what works and what blows up). I had a similar talk with Resig in CLJ years ago. Hopefully you take more from this than he did.
@James
You (and others) spend a lot of time telling me what _I_ have to do to get “people” to listen. Why don’t _you_ concentrate on listening yourself.
@Martin
No, I don’t need a blog. I post code reviews to Usenet where they belong and are easy to discuss. Blog comments are terrible for discussions (as we see here).
As for cinsoft.net, there will be a home page there in the near future. The domain was originally for a corporation I formed early in the century. Long story, but I ended up working as a independent consultant rather than running my own corp, so the domain sat idle. The “new” cinsoft.net will be all about browser scripting libraries (with mine chief among them). I’m sure you will find it very interesting and informative.
And to anyone reading this who is pondering using jQuery to build a site on the Web, you should think again. There is a much faster, far more compatible and better supported alternative. It’s not even a horse race at this point. And yes, I wrote it. That’s a _good_ thing. Maintenance on it has been virtually nil (the best thing for a Web site owner, unless they like flushing their money down the toilet). I also support it, which is an even _better_ thing. Contrast that to the “support” you get out of the jQuery reps. Would you be willing to file a ticket on that?
@David Mark
what a bitter troll….
I really don’t care about how much David Mark hates John Resig or any of that Object sh1t, because I am not a real programmer… what really concerns me is how fuck1ng cool that square background is!! James Padolsey Backgrounds For The Win. YE-AH!
@Al:
“I really don’t care about how much David Mark hates John Resig or any of that Object sh1t”
LOL. It’s the other way around.
@David Mark, woah boy you must get a lot of spam! Are you related to Marky Mark?