Beyond jQuery (The Book + 1 free "code hand" laptop sticker)

Retired

This book is no longer available for sale.

Beyond jQuery

Free yourself from the chains of jQuery by discovering the power of JavaScript and the modern web API

About the Book

Recently published by Apress. Order a copy on Amazon.

jQuery seems to be mindlessly injected into the vast majority of web applications and libraries.  In some cases, there there may be no logical reason for pulling in jQuery as a dependency.  For example: a library that only needs to perform a few simple element selections or DOM manipulations. Many web developers don’t really know when they need to use jQuery, and when they don’t. Pulling in this dependency seems to be a standard step when setting up a new library or web application. You shouldn’t be a jQuery developer, you should be a web developer, and part of being an effective web developer is a firm grasp on the underpinnings of web development.

Surprisingly, while browsers and JavaScript have improved significantly, the use of jQuery on the web has actually grown. It is surprisingly common to learn jQuery first, and JavaScript along with the web API much later on (and sometimes not at all). Relying solely on jQuery as your window to the web leaves large gaps in your knowledge. This in turn results in frustration when the abstraction that jQuery provides “leaks” and exposes you to the native aspects of the browser. In some cases, jQuery is ill-equipped to solve problems (such as file uploading). In these instances, those insistent on working exclusively through a library struggle as they do not have the knowledge or confidence to deal directly with the native browser API.  

In addition to being unnecessary in many instances, jQuery may adversely affect the performance of your project (sometimes significantly). Even something as simple as $(element).hide() has unexpected and serious performance implications. “Beyond jQuery” aims to educate developers, reveal the magic behind jQuery, help them solve common problems without it, and give them more confidence to abandon their crutch and embrace the power of the web API and standardized JavaScript.

About the Author

Ray Nicholus
Ray Nicholus

Ray Nicholus is a software developer for Widen in Madison Wisconsin who has been heavily involved in browser-based front-end development for years. From a popular JavaScript cross-browser no-dependency file upload library, to widely used web components, he has spent quite a lot of time writing libraries and web applications.

Since 2012 he has also been the lead developer and product manager of Fine Uploader, a popular cross-browser no-dependency file upload JavaScript library with a large number of unique features. He also is heavily involved in the open source web application software community through his work on various software libraries dealing with web components, video and image manipulation, and file identification.

In addition to frequent coding outside of his day job, he spends much time speaking about web development topics. He’s presented to students at the University of Wisconsin and DePaul University regarding careers in software development. Furthermore, he has prepared and delivered presentations to many professional developers regarding the mysteries of Cross Origin Resource Sharing, the importance of automated testing, the File API web specification, and the web components specifications. He organized and taught a JavaScript 101 class targeted at interested professionals, and spoke about the usefulness of uploading files directly to Amazon’s Simple Storage Service from the browser via Fine Uploader.

His writing includes the “You Don’t Need jQuery” series of blog posts, articles on Google Glass, and a large number of articles that help developers integrate file uploading capabilities into their web application or library. He was also featured in an article in Fortune Magazine by Anne Fisher based on his experiences with Google Glass in the workplace.

You can find a complete list of his most notable articles at RayNicholus.com.

Reader Testimonials

Robert DiBlasi
Robert DiBlasi

What makes Ray's approach interesting is the way he frames the discussion of "software developer" over "library integrator" or "jQuery programmer". Libraries & frameworks are just tools. Once you know the fundamentals, then you can make smart choices about why & when you might make use of such tools. You have options as a developer. "Beyond jQuery" has a very easy to read style. I like the way Ray gives confidence to the reader that they can use JavaScript instead of a library like jQuery.

Table of Contents

  •  
    • Acknowledgments
    • Preface
    • Introduction
    • I The Oppressive Magic of jQuery
      • 1. Why have we been using jQuery?
        • 1.1 Simplicity
        • 1.2 Community
        • 1.3 Habit
        • 1.4 Elegance
        • 1.5 Fear
      • 2. A crutch is only temporary
        • 2.1 You are a mechanic, not a driver
        • 2.2 Stunted growth
      • 3. The price of shortcuts (a true story)
        • 3.1 A new direction, a new web developer
        • 3.2 Shortcuts and my own stunted growth
        • 3.3 A challenge – no jQuery allowed!
      • 4. Focus on the implementation, not the magic
    • II You Don’t Need jQuery (anymore)
      • 5. Need vs. want
      • 6. Both sides of the acceptable use argument
        • 6.1 When is it acceptable to use it?
        • 6.2 When should you refrain from using it?
      • 7. Should you use other libraries instead?
        • 7.1 Small shims over large wrappers
        • 7.2 Writing your own shim
      • 8. The final word
    • III Understanding the Web API & “Vanilla” JavaScript
      • 9. Everything you need to know about browsers
        • 9.1 Ancient browsers
        • 9.2 Modern browsers
        • 9.3 Evergreen browsers
        • 9.4 Mobile browsers
        • 9.5 Non-browsers
      • 10. What is this “web API” and why is it important?
        • 10.1 The DOM API
        • 10.2 Everything else (non-DOM)
      • 11. JavaScript: A Less Elegant Version of jQuery?
        • 11.1 The language versus the web API
        • 11.2 History and standardization
    • IV Finding HTML Elements
      • 12. Core element selectors
        • 12.1 IDs
          • 12.1.1 jQuery
          • 12.1.2 Web API
        • 12.2 Classes
          • 12.2.1 jQuery
          • 12.2.2 Web API
        • 12.3 Element tags
          • 12.3.1 jQuery
          • 12.3.2 Web API
        • 12.4 Pseduo-classes
          • 12.4.1 jQuery
          • 12.4.2 Web API
      • 13. Selecting elements based on their relations
        • 13.1 Parents and children
          • 13.1.1 jQuery
          • 13.1.2 Web API
        • 13.2 Siblings
          • 13.2.1 jQuery
          • 13.2.2 Web API
        • 13.3 Ancestors and descendants
          • 13.3.1 jQuery
          • 13.3.2 Web API
      • 14. Mastering advanced element selection
        • 14.1 Excluding elements
          • 14.1.1 jQuery
          • 14.1.2 Web API
        • 14.2 Multiple selectors
          • 14.2.1 jQuery
          • 14.2.2 Web API
        • 14.3 Element categories and modifiers
      • 15. A simple replacement for $(selector)
    • V Using and Understanding HTML Element Attributes
      • 16. What is an attribute?
        • 16.1 History and standardization
        • 16.2 How do attributes differ from properties?
      • 17. Finding elements using attributes
        • 17.1 Finding elements using attribute names
          • 17.1.1 jQuery
          • 17.1.2 Web API
        • 17.2 Finding elements using attribute names and values
          • 17.2.1 jQuery
          • 17.2.2 Web API
        • 17.3 The power of wildcard and fuzzy attribute selectors
          • 17.3.1 Looking for specific characters
          • 17.3.2 Looking for specific words
          • 17.3.3 Attribute values that start or end with…
      • 18. Reading and modifying element attributes
        • 18.1 Class attributes
          • 18.1.1 Reading classes
          • 18.1.2 Adding and removing classes
          • 18.1.3 Toggling classes
        • 18.2 Data attributes
        • 18.3 Working with other standard & custom attributes
          • 18.3.1 Reading attributes
          • 18.3.2 Modifying attributes
    • VI HTML Element Data Storage and Retrieval
      • 19. Why would you want to attach data to elements?
        • 19.1 Tracking state
        • 19.2 Connecting elements
        • 19.3 Storing models directly in your elements
      • 20. Common pitfalls of pairing data with elements
        • 20.1 Memory leaks
        • 20.2 Managing data
      • 21. Using a solution for all browsers
        • 21.1 Storing small bits of data using data- attributes
          • 21.1.1 Reading and updating data- attributes with jQuery
          • 21.1.2 Using the web API to read and update data- attributes
        • 21.2 Complex element data storage and retrieval
          • 21.2.1 The familiar jQuery approach
          • 21.2.2 Using a more natural approach
            • 21.2.2.1 Removing data from our cache when elements are removed from the DOM
      • 22. The future of element data
        • 22.1 The HTML5 dataset property
        • 22.2 Leveraging ES6 WeakMap collections
    • VII Styling Elements
      • 23. There are three ways to style elements
        • 23.1 Inline styles
        • 23.2 Working with styles directly on the Element object
        • 23.3 Stylesheets
      • 24. Getting and setting generalized styles
        • 24.1 Using jQuery
        • 24.2 Without jQuery
      • 25. Setting and determining element visibility
        • 25.1 The typical jQuery approach
        • 25.2 The native web approach
      • 26. Determining width and height of any element
        • 26.1 Examining an element using jQuery
        • 26.2 Options natively provided by the browser
          • 26.2.1 Width & height of content + padding
          • 26.2.2 Width & height of content + padding + border
    • VIII DOM Manipulation
      • 27. The DOM: A central component of web development
        • 27.1 jQuery exists because of the DOM API
        • 27.2 The DOM API isn’t broken, it’s just misunderstood
      • 28. Moving and copying elements
        • 28.1 Moving elements around the DOM
          • 28.1.1 Moving elements using jQuery
          • 28.1.2 The DOM API’s solution to reordering elements
        • 28.2 Making copies of elements
      • 29. Composing your own elements
        • 29.1 Creating and deleting elements
        • 29.2 Text content
        • 29.3 Rich content
    • IX Ajax Requests: Dynamic Data and Page Updates
      • 30. Mastering the concepts of ajax communication
        • 30.1 Async is hard
        • 30.2 HTTP
        • 30.3 Expected and unexpected responses
        • 30.4 Web Sockets
      • 31. Sending GET, POST, DELETE, PUT, and PATCH requests
        • 31.1 Sending POST requests
        • 31.2 Sending PUT requests
        • 31.3 Sending DELETE requests
        • 31.4 Sending PATCH requests
      • 32. Encoding requests and reading encoded responses
        • 32.1 URL encoding
        • 32.2 JSON encoding
        • 32.3 Multipart encoding
      • 33. Uploading and manipulating files
        • 33.1 Uploading files in ancient browsers
        • 33.2 Uploading files in modern browsers
        • 33.3 Reading and creating files
      • 34. Cross-domain communication: an important topic
        • 34.1 The early days (JSONP)
        • 34.2 Modern times (CORS)
    • X Browser Events
      • 35. How do events work?
        • 35.1 Event types: Custom, and native
        • 35.2 Event propagation: Bubbling vs capturing
      • 36. Creating and firing DOM events
        • 36.1 Firing DOM events with jQuery
        • 36.2 Web API DOM events
      • 37. Creating and firing custom events
        • 37.1 jQuery custom events
        • 37.2 Firing custom events with the web API
      • 38. Listening (and un-listening) to event notifications
        • 38.1 jQuery event handlers
        • 38.2 Observing events with the web API
      • 39. Controlling event propagation
      • 40. Passing data to event handlers
      • 41. Event delegation: powerful and underused
      • 42. Handling and triggering keyboard events
        • 42.1 3 types of keyboard events
        • 42.2 Identifying pressed keys
        • 42.3 Making an image carousel keyboard accessible with the web API
      • 43. Determining when something has loaded
        • 43.1 When have all elements on the page fully loaded and rendered w/ applied styles?
        • 43.2 When has all static markup been placed on the page?
        • 43.3 When has a particular element on the page fully loaded? When has it failed to load?
        • 43.4 Preventing a user from accidentally leaving the current page
      • 44. A history lesson: Ancient browser support
        • 44.1 The API for listening to events is non-standard
        • 44.2 Form field change events are a minefield
        • 44.3 The Event object is also non-standard
    • XI Mastering Asynchronous Tasks
      • 45. Callbacks: The traditional approach for controlling async operations
        • 45.1 Node.js & the error-first callback
        • 45.2 Solving common problems with callbacks
      • 46. Promises: An answer to async complexity
        • 46.1 The first standardized way to harness async
        • 46.2 Using Promises to simplify async operations
          • 46.2.1 The anatomy of a Promise
          • 46.2.2 Simple Promise examples
          • 46.2.3 Fixing “callback hell” with promises
          • 46.2.4 Monitoring multiple related async tasks with promises
        • 46.3 jQuery’s broken promise implementation
        • 46.4 Native browser support
      • 47. Async functions: An abstraction for async tasks
        • 47.1 The problem with promises
        • 47.2 Async functions to the rescue
        • 47.3 Browser support
      • 48. The future of standardized async task handling
    • XII Common JavaScript Utility Functions
      • 49. Working with dates, text, XML, and JSON
        • 49.1 Dates
        • 49.2 Converting JSON into a JavaScript object
        • 49.3 Converting an XML string into a document
        • 49.4 String manipulation
      • 50. What kind of value is this?
        • 50.1 Primitives
        • 50.2 Arrays
        • 50.3 Objects
        • 50.4 Functions
      • 51. Making JavaScript Objects bend to your will
        • 51.1 Iterating over keys and values
        • 51.2 Copying and merging objects
      • 52. Solving problems with Arrays
        • 52.1 Iterating over array items
        • 52.2 Locating specific items
        • 52.3 Managing pseudo-arrays
        • 52.4 Mapping and merging
      • 53. Useful function tricks
        • 53.1 A word about JavaScript context
        • 53.2 Creating a new function from an old one
        • 53.3 Calling an existing function with a new context
    • About the Author
  • Notes

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub