Tuesday, October 4, 2011

Pragmatic Bookshelf.Pragmatic Guide to JavaScript.2010


Book Details:
By: Christophe Porteneuve
Copyright © 2010
Pages: 141
SBN-10: 1-934356-67-0
ISBN-13: 978-1-934356-67-8

About the Book
If you’ve been paying even minimal attention to JavaScript these past few years, you’ve heard this before: it’s the Next Big Language. Once the province of half-baked implementations and useless scrolling messages, it has become a world-class, dynamic, object-oriented language with super-fast implementations on the client and server sides.
On the one hand, JavaScript’s designers are endowing it with a new healthy dose of power, through the EcmaScript 5 (ES5) specification. On the other hand, kick-ass engines (such as V8, JavaScriptCore, SpiderMonkey, Rhino, and Carakan) and emergent standards and technologies (with CommonJS 1 and Node 2 in the lead) make it usable both in browsers and as stand-alone, powerful architectures on the server. Even the upcoming Internet Explorer 9 is upping its JavaScript game with the promise of huge speed boosts.
Not only is JavaScript a powerful, dynamic language, but it now has a rich ecosystem of professional-grade development tools, infrastructures, frameworks, and tool kits. It is versatile, fast, and very well suited to a wide range of programming tasks, especially when it comes to web-based applications and services.
It’s time to dive in!


What’s This Book About, and Who Is It For?
This book is not really intended to teach you “JavaScript the language.” For one thing, the language itself is not very complicated, so if you have prior experience in programming any reasonably common language—even if it’s just the basics (variables, loops, and so on)—you’ll get your bearings easily enough. You don’t need to actually know some JavaScript already (although it could help), and you certainly don’t need to be any sort of programming guru.
Actually, if you’re looking for the nitty-gritty and the hardcore technical details of JavaScript, you’ll be better off reading a dedicated resource, such as the “JavaScript core skills” section of Opera’s excellent Web Standards Curriculum.
Should you ever need even more intricate, implementation-level details, you could then head to either the official specs of the language or one of the massive “bible” books such as David Flanagan’s JavaScript: The
Definitive Guide [Fla06].
This book aims to provide you with quick yet qualitative solutions to common client-side JavaScript-based tasks, from low-level stuff (such as getting a reference to a DOM element) to intricate features (such as Ajax-based autocompletion). This means we’ll tackle JavaScript, CSS, the DOM, Ajax, JSON, and more. We won’t go deep into the server side; this book is mostly on the client side of things (most often the browser). You’ll encounter a couple of tiny PHP scripts along the way, for illustration purposes, but you could write
your server side any way you like—including in JavaScript, for instance, with Node!
It’s not just for copying and pasting, either. The text for each task takes care to highlight the key concepts, the potential gotchas, and the technical tricks you should take away from the task. Ultimately, you should step away from this book as a better JavaScript programmer.

Table of Contents
Dedication 11
Acknowledgments 12
Introduction 14
What’s This Book About, and Who Is It For? . . . . . . . . 14
This Book and JavaScript Libraries . . . . . . . . . . . . . . 15
This Book at a Glance . . . . . . . . . . . . . . . . . . . . . 16
How to Read This Book . . . . . . . . . . . . . . . . . . . . 17
I Bread and Butter: Pure JavaScript 18
Task 1. Dynamically Selecting a Method/Property 20
Task 2. Achieving Code Privacy with the Module Pattern 22
Task 3. Using Optional, Variable, and Named Arguments 24
II The DOM, Events, and Timers 26
Task 4. Obtaining References to DOM Elements 28
Task 5. Dynamically Styling Content 30
Task 6. Changing an Element’s Contents 32
Task 7. Running Code When the DOM Is Loaded 34
Task 8. Listening for Events (and Stopping) 36
Task 9. Leveraging Event Delegation 38
Task 10. Decoupling Behaviors with Custom Events 40
Task 11. Simulating Background Processing 42CONTENTS 8
III UI Tricks 44
Task 12. Pulling Off Classy Tooltips 46
Task 13. Making Unobtrusive Pop-Ups 48
Task 14. Preloading Images 50
Task 15. Creating a Lightbox Effect 52
Task 16. Implementing an “Infinite Scroll” 54
Task 17. Maintaining Viewport When Loading Content 56
IV Form-fu 58
Task 18. Temporarily Disabling a Submit Button 60
Task 19. Providing Input Length Feedback 62
Task 20. (Un)checking a Whole Set of Checkboxes at Once 64
Task 21. Validating Forms: The Basics 66
Task 22. Validating Forms: Going Further 68
Task 23. Validating Forms: The Whole Nine Yards 70
Task 24. Providing On-the-Fly Help Tooltips on Forms 72
Task 25. Autocompleting Input As It’s Typed 74
Task 26. Using Dynamic Multiple File Uploads 76
V Talking with the Server Side 78
Task 27. Reading/Writing Cookies 80
Task 28. Loading Stuff Through Ajax (Same Domain) 82
Task 29. Using JSON 84
Task 30. Using JSON-P 86
Task 31. Cross-Domain “Ajax” (Take 1) 88
CLICK HERE to purchase this book now.CONTENTS 9
Task 32. Cross-Domain “Ajax” (Take 2) 90
VI Making Mashups 92
Task 33. Syndicating Your Twitter Updates 94
Task 34. Syndicating Your Flickr Updates 96
Task 35. Geocoding a Location and Getting Photos For It 98

About the Author
Christophe Porteneuve has been doing IT R&D for more than 10 years, specializing early in Web development. He joined  Prototype Core in 2006, wrote Prototype and script.aculo.us in 2007, and sometimes speaks at conferences such as The Ajax  Experience. He’s the CTO of Ciblo.net in Paris, France, where he lives with his wife, Elodie.

Download


By: Shahen Gasparyan

No comments:

Post a Comment