Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

We are sorry to see you leave - Beta is different and we value the time you took to try it out. Before you decide to go, please take a look at some value-adds for Beta and learn more about it. Thank you for reading Slashdot, and for making the site better!

jQuery Cookbook

samzenpus posted more than 4 years ago | from the read-all-about-it dept.

Books 85

Michael J. Ross writes "Like all major programming languages, JavaScript can be extended in functionality through the use of libraries, such as jQuery, which is currently seeing tremendous popularity and enhancement in the Web development community. Designers and developers who want to learn how to use jQuery for creating rich user interfaces through client-side JavaScript are advised to begin their journey to jQuery proficiency by reading one of the many books dedicated to this powerful JavaScript resource — such as jQuery Cookbook: Solutions & Examples for jQuery Developers." Read below for the rest of Michael's review.This book was published by O'Reilly Media on 19 November 2009, under the ISBN 978-0596159771, and is authored by no fewer than 19 contributors — all quite knowledgeable of JavaScript and jQuery — and edited by one of those contributors, Cody Lindley. On the publisher's page for the book, visitors can read the book's description, table of contents, and errata, of which there are 22 as of this writing, although none have been confirmed by the authors or publisher. Visitors can also download all of the sample code used in the book, in addition to the eight code demos for Chapter 13. Lastly, prospective buyers can purchase the print version of the book, the electronic one (in PDF, ePub, and Mobi format), or the two combined at a considerable discount — or read the book as part of Safari Books Online.

jQuery Cookbook's 480 pages are organized into 18 chapters, covering a wide range of topics: the basics, element selection, utilities, dimensions, effects, events, forms, plug-ins, user interfaces, theming, Ajax, data formats, and testing. Lindley starts off the first chapter, titled "jQuery Basics," by presenting the advantages, philosophy, and organization of jQuery. Readers will likely chuckle at his suggestion that they memorize the jQuery API outline, which comprises two pages. The many code snippets are quite helpful, but they are needlessly long, partly because most of them contain far more HTML elements than are needed to illustrate the point, and also because each snippet contains the DOCTYPE and head tags, among others — often taking up more lines on the page than does the code pertinent to the topic at hand. This pointless and space-wasting redundancy is seen also in a few of the chapters that follow. As well, some of the passages in the first chapter's narrative are oddly phrased, frequently requiring a rereading of the material, while others could be made more concise. Additionally, some of the sample code contains bugs, which fortunately are detailed on the errata page mentioned earlier. The second chapter, "Selecting Elements with jQuery," presents numerous techniques for specifying elements within the DOM. The only obvious blemish in the material is in section 2.4, where the author refers to animated elements, but with absolutely no explanation as to what that means; countless new readers may assume he is referring to animated GIFs. Nonetheless, these two chapters form a helpful foundation for the rest of the manuscript.

The third chapter, "Beyond the Basics," gets off to a questionable start with the assertion that "jQuery can [] extend jQuery to infinite possibilities," which sounds like a line wisely rejected for the movie Toy Story. Yet the discussion continues on a solid footing, as it covers more advanced techniques for working with selected elements. Some of the discussion overlaps material presented in the previous two chapters, but it is always worthwhile to hear critical concepts explained from a different perspective. However, section 3.8, which briefly introduces jQuery plug-ins, is out of place; that material should be folded into Chapter 12, which focuses on that topic. The fourth chapter may be brief, but it explains several jQuery utility methods. Most of the code snippets use a format of "(function($) (jQuery);" — whose usage and advantages are not explained in this chapter, nor any earlier ones. This points up one of the key downsides of having almost every chapter of a programming book written by separate authors: readers can be confused or misled by disparities in coding practices, especially when the reasoning behind them is not given. The title of the fifth chapter, "Faster, Simpler, More Fun," is a bit misleading, because the authors don't explain how to make one's jQuery programming simpler or more fun, but they do provide a great deal of information on troubleshooting, performance optimization, and jQuery coding practices, including those pertaining to progressive enhancement, accessibility, and unobtrusiveness. Section 5.19 lacks a figure showing the menu being discussed, but that's the only obvious flaw.

The remaining chapters are dedicated to more specific aspects of jQuery programming, including the important topics of page layout as well as element positioning and sizing, discussed in Chapter 6. The subsequent chapter delves into effects, which is one of the more exciting topics in the jQuery realm. Even though a portion of the readers may be put off by the trickiness of the code, the material does demonstrate some of the powerful capabilities of jQuery effects — which in conjunction with HTML5 may easily encroach on areas of client-side programming formerly dominated by Adobe Flash. Throughout Chapter 7, most if not all places where the author refers to the "mouse," he apparently means the "mouse pointer." Events play a critical role in JavaScript software, and even more so for code that is mostly jQuery — thus the value of chapters 8 and 9, which examine basic and advanced event handling. The next pair of chapters discuss a variety of techniques for enhancing HTML forms, from scratch and through the use of jQuery plug-ins. The sample source code is better commented than what is seen elsewhere in the book, and the explanations are quite good. The subsequent chapter focuses on jQuery plug-ins, beyond their usage within HTML forms, and briefly explains how to create your own plug-ins and how to perform unit testing on them.

Because JavaScript is primarily a client-side technology, it should come as no surprise that jQuery can prove an outstanding tool in crafting user interfaces for Web sites and Web-based applications. Chapters 13 through 15 explore such topics as drop-down menus, sliding panels, rotating images, modal windows, tooltips, the jQuery UI, and how to style jQuery UI widgets, a.k.a., theming. No Web interface is an island, and over the years there have emerged a number of data formats and protocols for utilizing those formats for transmitting information between browsers and servers — such as Ajax, XML, JSON, and JSONP — covered in Chapter 16. Finally, the last two chapters of the book are geared more to testing and deployment, and less so to interface design and development. The topics covered include techniques for persisting data in the browser, managing large amounts of code and data for major software projects, automating the unit testing of jQuery code, testing callbacks and user actions, grouping and selecting tests, and more.

Overall, jQuery Cookbook starts off with some basics, and only then moves on to higher-level concepts and related use cases. However, the book is ostensibly aimed at beginners and intermediate JavaScript programmers, but the former group may find the ideas difficult to grasp fully, despite the introductory chapters — because some of the techniques are fairly advanced, they involve terminology unfamiliar to anyone new to jQuery, and some of that terminology is not explained. On the other hand, the recipes are generally well written and clear, supplemented with properly tested and working code. Consequently, anyone who takes the time to work through the examples patiently, should be well rewarded.

Because of its coverage of a wide range of topics, jQuery Cookbook can be used not only as a learning aid, but in some respects also as a reference — and in this regard the book's index will be quite useful. In light of the considerable length of the manuscript, reading it from stem to stern would involve an investment of time — especially if one were to work through all of the examples and try them out in one's own development environment — quite easily, in fact, since all of it can be downloaded from the publisher's site. Most of it, however, is organized as plain text files, and not HTML files; and no reason is provided for this annoying choice.

In terms of the layout and appearance of the text and figures, one flaw is that in countless lines throughout the book, the words are jammed together, making it difficult to read the text rapidly. In fact, some of these lines almost look like single words. This is also seen in the subheads, an excellent example of which can be found on page 149: "Solution2:ChangingthehrefAttributeoftheStylesheetThat'sResponsible." Unfortunately, the same is true for much of the source code, but in a different sense: Operators and variables are jammed together, clearly illustrating the need for whitespace in making code more readable. Some of the code is excessively long (noted earlier), and the authors are inconsistent as to whether their JavaScript is placed at the end of the body element or in the header element. Nonetheless, the sample code is generally of good quality.

There is another aspect related to not only this book but all other computer programming books for which individual chapters are written by different authors: jQuery Cookbook does not seem to be a single book, but instead a collection of books that were bundled together because of a common thread, namely, jQuery. This leads to some of the problems mentioned earlier, such as discrepancies in coding techniques and formatting — from which the beginning reader is supposedly learning best practices. On the other hand, the multi-author approach makes it possible for each major subject area to be handled by one or more writers who are expert in that particular area — which in turn results in a better product overall, even if one or two of the chapters are noticeably weaker than the others.

The book contains a number of copyediting flaws not listed on the aforementioned errata page: "elevated" should instead read "alleviated" (page 12); "or [its] alias" (13); "could change" should read "could be changed" (26); "jQuery('a')removeAttr('title')" is missing a "." (30); "'blue')" is missing a terminating ";" (50); "season in" should read "season" (56); "was contained" should read "is contained" (144); "position: absolute" in the narrative should not be broken between two lines (156); "great[er] than" (157); "equal[-]sized panels" (160); "only running" should read "only runs" (165); "still support[s]" (168), "#source5txt" should read "#source4txt" (217); and at this point I stopped recording errata. Also, in countless places in most of the chapters, semicolons are used where dashes are called for, and vice versa. O'Reilly's copyeditors should have detected and fixed those errors prior to publication.

Yet most of these blemishes are of little significance. What really counts is the overall value provided to the reader: Usable for both learning and reference, jQuery Cookbook delivers a tasty buffet of programming essentials, best practices, illustrative examples, optimization tips, and other information of value to JavaScript developers who wish to spice up their Web creations with jQuery.

Michael J. Ross is a freelance website developer and writer.

You can purchase jQuery Cookbook: Solutions & Examples for jQuery Developers from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

Sorry! There are no comments related to the filter you selected.

first rtret sg (-1, Offtopic)

Anonymous Coward | more than 4 years ago | (#32018244)

askdjaskdjas ssfd first ansdapsd

First prevorb (-1, Troll)

Hognoxious (631665) | more than 4 years ago | (#32018258)

You can't polish a turd, or so the proverb goes. But it seems you can extend one with libraries, and write a book about it to boot.

Re:First prevorb (3, Funny)

Tumbleweed (3706) | more than 4 years ago | (#32018372)

You can't polish a turd, or so the proverb goes. But it seems you can extend one with libraries, and write a book about it to boot.

Ah, that would be The tQuery Cookbook, available from O'Reilly. One guess as to the cover 'animal'. Hint: It's a character on South Park.

Re:First prevorb (1)

talkingpie (1443621) | more than 4 years ago | (#32018472)

Manbearpig!

Re:First prevorb (1)

WrongSizeGlass (838941) | more than 4 years ago | (#32018604)

[Cartman] That's just the way I roll [/Cartman] from Breast Cancer Show Ever [wikipedia.org] ?

Re:First prevorb (1)

corbettw (214229) | more than 4 years ago | (#32018656)

Hidee-ho!

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32021454)

Oh, but you can polish a turd. [discovery.com]

Re:First prevorb (1)

Abcd1234 (188840) | more than 4 years ago | (#32022502)

Says the guy who apparently doesn't understand why Javascript is actually pretty awesome. A dynamic language that encapsulates lisp-like functional capabilities in a familiar syntax. Yes, how horrible.

Wait, let me guess, you're one of those guys who doesn't understand the difference between Javascript, the language, and the horror that is the DOM?

Re:First prevorb (1)

Tumbleweed (3706) | more than 4 years ago | (#32022680)

Wait, let me guess, you're one of those guys who doesn't understand the difference between Javascript, the language, and the horror that is the DOM?

Wait, let me guess, you're one of those guys who doesn't understand when someone tells a joke, and when replying, can't figure out which is the correct poster to reply to. Right?

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32037908)

Epic fail, jew.

Re:First prevorb (0)

davester666 (731373) | more than 4 years ago | (#32018390)

Yes, stop all this Javascript crap. Let's all go back to Flash/Actionscript.

Re:First prevorb (1, Informative)

Anonymous Coward | more than 4 years ago | (#32018646)

Actionscript and javascript are both ECMAscript. They are the same language but used in slightly different contexts.

Re:First prevorb (1)

ByOhTek (1181381) | more than 4 years ago | (#32027990)

Where's a "woosh" when you need one?

Oh, right here.

WOOOOOOOSH!!!

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32018454)

It is a well defined, well designed language with some great parts. It is very good for what it is designed to do. The only problem is the inconsistent implementation which means when you actually want to write a program.... Okay. Fine. It is a turd.

Re:First prevorb (1)

MemoryDragon (544441) | more than 4 years ago | (#32018510)

The biggest problem is the entire dom aspect, of doing things, the dom needs subtree isolation,
there have been various approaches like xul which tackled that problem, but not a single one became standard.
Add to that that the dom is used nowadays as UI definitionc construct and your are in a hell of a mess.

Re:First prevorb (1, Funny)

Anonymous Coward | more than 4 years ago | (#32018638)

That is right. The two major problems with javascript is the dom specification, inconsistent implementation, and it is a prototype based language... The THREE major problems with javascript is the dom specification, inconsistent implementation, it is a prototype based language and a total lack of good development tools...

Re:First prevorb (1)

Nadaka (224565) | more than 4 years ago | (#32019008)

Amongst the major problems with javascript are the dom specification, inconsistant implementation, it is a prototype based language, a total lack of good development tools, semi-colon insertion,... etc.

You forgot to finish the joke.

Re:First prevorb (1)

MemoryDragon (544441) | more than 4 years ago | (#32019594)

Actually the dev tools have become quite good, I especially like what Netbeans and Intellij have to offer in this area.
For the rest I agree mostly.

Re:First prevorb (1)

shutdown -p now (807394) | more than 4 years ago | (#32020490)

Proper JS support has been the feature which all mainstream IDEs have been chasing recently, competing on achievements. It's not just Java IDEs, either - VS has just added a bunch of goodies [asp.net] , too.

Re:First prevorb (1)

ByOhTek (1181381) | more than 4 years ago | (#32028016)

Well, tools [gnu.org] aren't [vim.org] a big [microsoft.com] problem.

I can think of three off the top of my head that I know work fine, and I'm pretty sure I could add Eclipse and Anjuta to the list.

Incosistent implementation is an issue, but jQuery fixes a lot of that. I only had to add two or three functions to my 'compatibility.js' file I use with everything to get IE in line (the rest of the stuff is things I think JS is missing in the default).

Granted, I'd still rather be programming in Python, C or even Java with a good UI library, but for the purposes of web development, it's not bad, and it takes some display related logic off of my servers, without having a huge client side hit.

Re:First prevorb (1)

colfer (619105) | more than 4 years ago | (#32019772)

Another problem is download size, at least for those few of us still on occasional dialup or slow 3G. The minified version of JQuery is 72K. Still that's better than the NYT home page, which makes 30 requests for JS files, though only 60K total.

Re:First prevorb (1)

amn108 (1231606) | more than 4 years ago | (#32020548)

I agree, although one thing that annoys me slightly is the lack of "spell checking" tools for JavaScript (and other ECMA-262 variations). In other words, dynamically typed objects make you occasionally spell property names wrong, and the runtime will not complain until you run the program, where a property are taken as simply some other one. Stuff like that.

JavaScript Lint implementations help a lot, but they specifically state so and do no checking of such object properties. Which is understandable for a dynamically typed language.

It's not just the properties, there are other ways one can mess up the code without the lint catching it. This is where ECMA-262 fails - extra debugging round everybody ;-)

I still like it though. It's just like a useful tool for simple jobs.

Re:First prevorb (1)

Short Circuit (52384) | more than 4 years ago | (#32021630)

The biggest problem with writing a pure-JavaScript spellchecking tool would be providing the dictionary for it to work with, and pulling in that dictionary would add significantly to the page load time.

Of course, there are uses of JavaScript that don't require the code and data to be pulled from a network connection--in those cases, it should fairly easy to hack together one of your own by implementing a phonetic algorithm [wikipedia.org] and/or using an edit distance calculation [wikipedia.org] to identify plausible alternatives.

Re:First prevorb (1)

amn108 (1231606) | more than 4 years ago | (#32027408)

I don't think one needs to "spell-check" the syntax every time. One time will do it. A browser could/should JIT or cache the program bytecode anyway.

And you are proposing weird things :-) When I wrote spellcheck I meant something like a smarter syntax check. A pure syntax checker will not do because it is not smart enough to catch following errors

function f()
{
          var x = get_x();
          calculate(z);
}

In the above, should we assume that 'z' is intended a variable of an outer scope? Or maybe the programmer hit the wrong key just that once, and it should have been 'x' instead of 'z'? These kind of things in JavaScript, which usually produce errors at compiling stage, go unnoticed, and JavaScript lint for instance does not complain by default. Point is JavaScript is intended for quick programming hack-up jobs, like web scripting used to be like back in the days. With todays increasing usage of it in libraries and complex website interactions, it starts to be evident how it's dynamics impede its human operators.

Re:First prevorb (1)

Short Circuit (52384) | more than 4 years ago | (#32029530)

Weird things is what I do, though in this case, somehow, I thought you were talking about an English spellchecker, not an intuitive parser.

Embed something like this [javascriptlint.com] in your code editor, and have the editor display the lint output after N seconds of inactivity.

Re:First prevorb (1)

amn108 (1231606) | more than 4 years ago | (#32030602)

No offense, but it insults me somewhat that you are offering me use javascript lint, after I have written about using it a post ago. Of course, one cannot expect Slashdot readers to read the entire conversation, I guess :-)

Re:First prevorb (1)

Short Circuit (52384) | more than 4 years ago | (#32031124)

Sorry for the offense. I already mentioned that I misinterpreted your original comment. What I probably didn't mention was that the original post was in the middle of a 14-hour work day, and the one you just replied to came after six hours of sleep.

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32018458)

Actually the MythBusters have proven that you can, in fact, polish a turb.

Busted!

Re:First prevorb (1)

revlayle (964221) | more than 4 years ago | (#32018672)

We know a turd can be polished... it's just that... well, it's still a turd.

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32019536)

But is it not a shiny turd?

Re:First prevorb (1, Funny)

Anonymous Coward | more than 4 years ago | (#32018840)

You can't polish a turd, or so the proverb goes. But it seems you can extend one with libraries, and write a book about it to boot.

Yes, you can.
http://www.youtube.com/watch?v=hBj6PonX14A

Re:First prevorb (1)

Hognoxious (631665) | more than 4 years ago | (#32021612)

Actually (and you owe me ten minutes of my life back, you fat faggot) it shows you can't.

Re:First prevorb (5, Informative)

Mad Merlin (837387) | more than 4 years ago | (#32018892)

You seem to be in the wrong thread... Javascript is quite a nice language.

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32019176)

You seem to be in the wrong thread... Javascript is quite a nice language.

And you seem to be in a different profession. Javascript in large web-based aplications is notoriously horrible to maintain. Perhaps it's not literally as bad as coding your CGIs in assembly language, but it's not too far off.

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32021426)

Yeah, so? It's still what you have to use in the real world.

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32022280)

You seem to be in the wrong thread... Javascript is quite a nice language.

And you seem to be in a different profession. Javascript in large web-based aplications is notoriously horrible to maintain. Perhaps it's not literally as bad as coding your CGIs in assembly language, but it's not too far off.

As opposed to what? Using Postbacks everywhere?

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32020906)

You seem to be in the wrong thread... Javascript is quite a nice language.

great to see this post :)

Regards
http://extrafast.onpw.de

Re:First prevorb (1)

mikerz (966720) | more than 4 years ago | (#32021030)

lol :) It's useful, but it's a pain in the butt for compatibility issues.

Re:First prevorb (1)

Abcd1234 (188840) | more than 4 years ago | (#32022542)

What the hell does that have to do with Javascript, the language?

That's like saying C, the language, sucks because you don't like POSIX.

Re:First prevorb (1)

mikerz (966720) | more than 4 years ago | (#32023004)

The language is messy.

Re:First prevorb (1)

Abcd1234 (188840) | more than 4 years ago | (#32023176)

It's not perfect, no (the fact that it's weakly typed rather sucks, and it's handling of local vs global variables can be... surprising), but it's hardly messy.

Re:First prevorb (-1, Flamebait)

Anonymous Coward | more than 4 years ago | (#32025460)

messy, like your mouth after you suck off half a dozen niggers?

Re:First prevorb (1)

b4dc0d3r (1268512) | more than 4 years ago | (#32034164)

mikerz did not say it sucked, in fact did not comment on the language at all. You could have said the same thing for C around 1997 - cross-compilation on gcc and msc was difficult because of compatibility issues. The quality of the language didn't matter, the quality of the implementations did.

Technically, mikerz was off-topic, but it's hard to praise the language when you can't write much useful in it without a compatibility library like jQuery or your own homebrew hacks. Writing a valid C program you can't compile in any implementation would be a better analogue.

Yup, tell me all of your success stories cross-compiling C in 1997 and how you managed to write javascript that runs in IE and firefox, you probably took a lot of time figuring out the implementations to get it working right, I don't care. It's not as compatible as it needs to be, and that sucks.

Re:First prevorb (2, Insightful)

Abcd1234 (188840) | more than 4 years ago | (#32040442)

You could have said the same thing for C around 1997 - cross-compilation on gcc and msc was difficult because of compatibility issues.

No, actually you couldn't.

What you describe is a differing implementation of the language itself. ie, a C program that would compile on gcc would not compile on msc because of issues with the way the compiler compiled the language.

But no such incompatibilities exist with javascript. Take a valid javascript program that corresponds to the latest ECMA standard and throw it at any intepreter, and the interpreter will consider it a valid javascript program.

Now, are there incompatibilities in the *APIs*? Yes, absolutely. But that has absolutely nothing to do with the language itself.

Frankly, it seems to me that you, too, are having trouble differentiating these issues. Javascript is a language. The DOM is an API. The DOM sucks. Badly. But Javascript is actually a very nice language, and through tools like Rhino, can even be used outside of the browser environment and leveraged as a fairly powerful general scripting language.

Re:First prevorb (0)

Anonymous Coward | more than 4 years ago | (#32022170)

Javascript is an extremely elegant and powerful language.

It has sort of a bad reputation, but that's mainly because of 2 issues:

1. Browser incompatibility issues and crappy implementations (IE).

2. People associate it with Java, and then don't take the time to learn the differences between class-based inheritance and prototype-based inheritance. Java programmers talk about the superiority of composition and using interfaces instead of inheritance. Guess what: they're right, and prototype inheritance is a very elegant way to implement composition without using messy multiple inheritance or giving up DRY.

With browser support converging, and JIT compilers like V8, Javascript's future looks very bright.

What's in a name? (5, Funny)

ClosedSource (238333) | more than 4 years ago | (#32018378)

I've heard the same group that developed JQuery is working on a database querying framework called JDisplay.

Re:What's in a name? (-1)

Anonymous Coward | more than 4 years ago | (#32018696)

jQuery is a library based around querying the DOM and applying functions to the results.

Your failure to understand something doesn't make it wrong or confusing, it just means you don't understand. And in this case, it's clear that your non-comprehension largely the product of your own laziness.

Re:What's in a name? (1)

ClosedSource (238333) | more than 4 years ago | (#32018866)

Actually, it was an attempt at humor because the summary said JQuery was used for developing "rich user interfaces".

Re:What's in a name? (0, Redundant)

stimpleton (732392) | more than 4 years ago | (#32019068)

Oh. Yes I see. "JQuery" should be for database. And "JDisplay" for UI's.....as Query is usually associated with databases. Read in that context your original post is quite amusing.

Re:What's in a name? (1)

Gorath99 (746654) | more than 4 years ago | (#32018990)

Exactly. That's why cStack would be a perfect name for an office suite, and cTree for a web browser.

Re:What's in a name? (-1, Troll)

Anonymous Coward | more than 4 years ago | (#32019038)

Well, sure, if there's a legitimate motivation for those names. The motivation for the name jQuery is perfectly reasonable if you're in the target audience (web front end developers) and if you bother to find out about it.

Your sarcasm would work better if you understood what the grownups were talking about.

Re:What's in a name? (-1, Troll)

Anonymous Coward | more than 4 years ago | (#32019854)

how about if you fucked yourself and left this thread completely since your comments are of no use to anyone and are ruining this conversation.

asshole.

Re:What's in a name? (-1, Troll)

Anonymous Coward | more than 4 years ago | (#32020554)

But why?

I've obviously caused you some frustration and unhappiness, and since you're clearly of no overall value to the human race, perhaps that bit of misery will drive you to becoming an hero.

Hope springs eternal that, eventually, our species will be rid of people like you.

Re:What's in a name? (1)

ByOhTek (1181381) | more than 4 years ago | (#32028054)

Actually, if you wanted to carry on the analogy, it would be "cBrowser" for the office suite, and "cWriter" for the web browser (because you are browsing documents, and the web browser has optimized form handling)

Re:What's in a name? (0)

Anonymous Coward | more than 4 years ago | (#32019790)

You realize it started as a javascript framework for querying the DOM for elements you were interested in working with?

And only subsequently branched out to include presentation functions (a la jQuery UI)?

Re:What's in a name? (1)

rsborg (111459) | more than 4 years ago | (#32024416)

I've heard the same group that developed JQuery is working on a database querying framework called JDisplay.

Always thought it was a weird name, but having used it, it's clear the name jQuery refers to the power that comes from being able to "query" the DOM with CSS3 Selectors (originally Resig wanted to name it JSelect [stackoverflow.com] )

Play with it for a while... going back to getElementById() and getElementByName seem archaic (Sizzle js does exist now, and jQuery 3+ uses that).

after reading that review (1)

digitalsushi (137809) | more than 4 years ago | (#32018496)

I guess I understand that we can't all be writers.

Re:after reading that review (1)

MikeTheGreat (34142) | more than 4 years ago | (#32018996)

I hate to harp, but I have to agree

On the publisher's page for the book, visitors can read the book's description, table of contents, and errata, of which there are 22 as of this writing, although none have been confirmed by the authors or publisher

So there are 22 what? Chapters? Chapters and errata? Description, chapters and errata?

And why exactly can't the authors or publisher confirm anything? You'd figure that at least one of the 19 contributors could confirm at least their own contributions :)

Re:after reading that review (1)

Concerned Onlooker (473481) | more than 4 years ago | (#32019820)

It seems pretty clear from that sentence that the last clause is about the errata. This is petty harping. It's a fine review.

Re:after reading that review (1)

b4dc0d3r (1268512) | more than 4 years ago | (#32033800)

I'm with you on that one, but the publisher's website has 22 errata that the publisher has not confirmed. That's the sort of thing you should catch yourself before an editor sees it. If you don't have an editor, you need to try harder. Or we're not the intended audience, could be that.

a what? (0, Troll)

tabooli (927310) | more than 4 years ago | (#32018676)

"Like all major programming languages, JavaScript..." HAHAHAHAHHAAHAHA

Don't need the book. (1, Insightful)

Anonymous Coward | more than 4 years ago | (#32018918)

If you're fairly comfortable in JavaScript you should be able to look at the online documentation at jQuery and figure it out in a day or two. The framework is very simple to understand and it'll save you the $20+ dollars you'll spend on the book.

Where's the cookbook?! (1)

Vu1turEMaN (1270774) | more than 4 years ago | (#32019022)

I must say....I got really excited. I hoped that someone had finally coded a GOOD cookbook/recipe/mealplanner application, and that it was SO GOOD slashdot picked it up. Open source, minimal bull to get it running, and can export to any format.

I am dissappoint.

TL;DR (1)

coredog64 (1001648) | more than 4 years ago | (#32019408)

This is only the second time I've seen a review of an O'Reilly book exceed the length of the book under review (The first was the review of false in a Nutshell). Actually, I just wanted to post "TL;DR" but didn't want to hassle with the lameness filter...

Not explained? (0)

Anonymous Coward | more than 4 years ago | (#32022002)

Most of the code snippets use a format of "(function($) (jQuery);" — whose usage and advantages are not explained in this chapter, nor any earlier ones.

I beg to differ. 3.7, "Configuring jQuery Not to Conflict with Other Libraries". Page 71. If you're going to write a scathing review it behooves you to actually read the source material first.

File size of jQuery (2, Interesting)

Anonymous Coward | more than 4 years ago | (#32023864)

Using jQuery adds a 72174 bytes download to your website...

Now, granted there's people out there who think nothing of having 1MB web pages and it's not really a problem for people with high-speed connections, however some people have limited monthly bandwidth, others are still on dial-up, more and more are using wireless networks with their cellphones and those networks aren't as fast as a cable modem, not to mention the limited bandwidth per tower.

Is it really worth the 72174 bytes? Or are people just lazy?

56kbps = 56000 bits per second = 7000 bytes per second. You're adding 10 seconds to the download time of people on 56kbps modems.

Re:File size of jQuery (1)

vacarul (1624873) | more than 4 years ago | (#32024656)

this exactly why I'm not using it. But great library!

Re:File size of jQuery (0)

Anonymous Coward | more than 4 years ago | (#32025628)

<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>

So long as the browser does its job correctly, the file should be downloaded once, for the first page that loads jQuery from the CDN. After that, it should be cached, and there's no added download time. Given that we're now talking about 72174 bytes, once, instead of multiplying it for every site that uses the code, I'd say it's clearly worth it. I mean, over the course of 150,000 page loads, it's amortized 0 bytes!

Re:File size of jQuery (1)

hemlock00 (1499033) | more than 4 years ago | (#32026272)

Better to download the actual script files from their website rather than linking to it. If it's unable to connect for any reason (happened to me personally) the layout to all potential customers is most likely not what they would consider a professional website since all your pages are being displayed at once.

Re:File size of jQuery (1)

Tablizer (95088) | more than 4 years ago | (#32025640)

Some JavaScript libraries are "recompiled" to make them smaller by reducing variable names to a, a1, fz etc. and stripping out all non-executable elements such as comments and white-space. The result, if you lose the original, makes early BASIC look readable in comparison.

Re:File size of jQuery (1)

Yosho (135835) | more than 4 years ago | (#32025926)

Is it really worth the 72174 bytes? Or are people just lazy?

56kbps = 56000 bits per second = 7000 bytes per second. You're adding 10 seconds to the download time of people on 56kbps modems.

Actually, jQuery is about 24k after it's been minified and gzipped (and any modern browser will gzip text over the wire), so that's slightly over 3 seconds for a 56k modem, and that's only once for your entire site. That's practically nothing if your site is more than one or two static pages, especially if you have anything crazy like JPG images in your page.

Re:File size of jQuery (3, Interesting)

jedrek (79264) | more than 4 years ago | (#32026922)

the slashdot page i read this on is 281k. come join us here in 2010.

Re:File size of jQuery (1)

thijsh (910751) | more than 4 years ago | (#32027564)

Really? You're questioning some Kb used on a very useful library that is a basic cross-browser requirement for good scripting. In this day and age where broadband is available to anyone...

I'm currently developing a webapp which is quite heavy in scripting, css and images (for the user interface). To get to the login page you need to download more than 500Kb, which might be a lot for any random static page but not for a large complex webapp. It is worth adding the proper caching headers so all subsequent pageloads are small and fast since all the script/css/images are loaded already... Oh yeah and I use the webapp over mobile internet, you won't even notice any speed hit. I use my mobile internet to demonstrate the webapp to my boss in fact.

Re:File size of jQuery (1)

Pastis (145655) | more than 4 years ago | (#32028408)

You mean that you it's a problem to 72k to a page to write javascript code that will turn your static web page into a dynamic one, making your site much more usable ? How big is an image already ?

Don't forget as well that by placing this piece of code outside the page, it be be cached for a long time, not to be re-downloaded for a while. It's more or less a one time cost if your browser and web application are properly configured.

(or course you can develop in JS without jquery, but it takes more time, more code, and without a JS framework you're going to have a lot of boiler plate code).

Re:File size of jQuery (1)

b4dc0d3r (1268512) | more than 4 years ago | (#32033866)

72k I don't have to download because I have NoScript, and your site better degrade gracefully or I usually find an alternative. If your site does not have minimum functionality without scripting, I don't consider it functional at all.

Re:File size of jQuery (1)

Pastis (145655) | more than 4 years ago | (#32041994)

You're shifting the problem from the size costs to the fact that you want a web mostly without javascript. NoScript is (to me) mostly about security and reducing XSS attacks.

So you know that if you enable noscript on a site, the external JS files aren't even downloaded ? So when it comes to bandwidth, where is the damn problem?

Second as I said earlier, the file will be downloaded *once* and will probably help you to download less data later on (that might in fact help you to speed up your browsing and reduce your bandwidth usage ? ('Ajax' less code will typically make you load full pages, e.g. slashdot comment page is about 8k, which you save if you use javascript, as the form will be inlined, etc).

So JS, well used, can make you SAVE bandwidth and make the site more useful. Why complain about downloading *once* 24k of data (compressed) that makes you save bandwidth ?

If you decide to not use javascript because you don't trust it, it's your decision but it's a different argument. Let's title the thread differently then. And if you don't trust the JS code that comes from a site, then why do you use that site ? Can you give us an example of a site you use with javascript disabled and why ? I am just curious.

Re:File size of jQuery (1)

talldean (1038514) | more than 4 years ago | (#32029074)

So, ah, welcome to the modern world of browser caches. It's absolutely worth 70k, *once*, because you shouldn't need to load it more times than that. It gives you easy cross-browser compatibility and a huge amount of features. Amazon manages to use it, as does Twitter, Dell, Best Buy, ESPN, and a few others. If those companies are okay with the one-time-lag, I can suspect it's okay for the vast majority of users you're going to hit.

Re:File size of jQuery (1)

CaptSaltyJack (1275472) | more than 4 years ago | (#32037570)

You're adding 10 seconds to the download time of people on 56kbps modems.

What the heck is a 56kbps modem?! Wait, wait, it's coming to me. Ahh yes, I just saw one of these at a technology museum. Quaint!

Re:File size of jQuery (0)

Anonymous Coward | more than 4 years ago | (#32042586)

Yeah, and some people still have Black & White TV Sets.

And write with a Quill Pen & Ink Well.

And travel around in a horse drawn carriage.


This is 2010, people. Get with the program.

Don't quit your day job! (0)

Anonymous Coward | more than 4 years ago | (#32025188)

That was a terrible review. I noted several spelling mistakes and I didn't like the formatting. On the other hand, it was saved by somewhat useful information being put after the negative nit-picky introduction sentences.

Odd phrasing (0)

Anonymous Coward | more than 4 years ago | (#32025242)

"As well, some of the passages in the first chapter's narrative are oddly phrased"

I found I had to reread that.

GWT Query (1)

David Off (101038) | more than 4 years ago | (#32027526)

Is anyone working with GWT Query? What is the status of this project?

"Page" vs webpage/website (1)

PurplePhase (240281) | more than 4 years ago | (#32028804)

For anyone writing a book review, please be specific: if you're referring to the publisher's or book's website, say so. Otherwise you confuse the issue by talking about non-existent pages in the book!

Grammar nazi: "points up"?! (1)

PurplePhase (240281) | more than 4 years ago | (#32028912)

This points up one of the key downsides...

Is the author trying to average out the verticals?

"points out" is the English version.

Book review bottom line doesn't add up (1)

rpg25 (470383) | more than 4 years ago | (#32043514)

I didn't know what to make of this book review. The book review points out a lot of ways in which this book is a mess (poorly copy-edited, unclear motion from one author to another, terminology used without definition, etc.). Then at the end, it says:

Usable for both learning and reference, jQuery Cookbook delivers a tasty buffet of programming essentials, best practices, illustrative examples, optimization tips, and other information of value to JavaScript developers who wish to spice up their Web creations with jQuery.

What gives? This seems like a conclusion ripped from an entirely different review. If it's that this book is really the only choice right now, then you could say that. but this sentence here looks like it comes at the end of a rave review.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?