Beyond jQuery (The Book + 1 free "code hand" laptop sticker)
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.
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
- 1. Why have we been using jQuery?
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
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.1 The language versus the web API
- 11.2 History and standardization
- 9. Everything you need to know about browsers
IV Finding HTML Elements
12. Core element selectors
- 12.1.1 jQuery
- 12.1.2 Web API
- 12.2.1 jQuery
- 12.2.2 Web API
12.3 Element tags
- 12.3.1 jQuery
- 12.3.2 Web API
- 12.4.1 jQuery
- 12.4.2 Web API
- 12.1 IDs
13. Selecting elements based on their relations
13.1 Parents and children
- 13.1.1 jQuery
- 13.1.2 Web API
- 13.2.1 jQuery
- 13.2.2 Web API
13.3 Ancestors and descendants
- 13.3.1 jQuery
- 13.3.2 Web API
- 13.1 Parents and children
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
- 14.1 Excluding elements
- 15. A simple replacement for $(selector)
- 12. Core element selectors
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…
- 17.1 Finding elements using attribute names
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
- 18.1 Class attributes
- 16. What is an attribute?
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
21.1.1 Reading and updating
data-attributes with jQuery
21.1.2 Using the web API to read and update
- 21.1.1 Reading and updating
21.2 Complex element data storage and retrieval
- 21.2.1 The familiar jQuery approach
21.2.2 Using a more natural approach
- 126.96.36.199 Removing data from our cache when elements are removed from the DOM
- 21.1 Storing small bits of data using
22. The future of element data
22.1 The HTML5
22.2 Leveraging ES6
- 22.1 The HTML5
- 19. Why would you want to attach data to elements?
VII Styling Elements
23. There are three ways to style elements
- 23.1 Inline styles
23.2 Working with styles directly on the
- 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
- 23. There are three ways to style elements
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
- 28.1 Moving elements around the DOM
29. Composing your own elements
- 29.1 Creating and deleting elements
- 29.2 Text content
- 29.3 Rich content
- 27. The DOM: A central component of web development
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)
- 30. Mastering the concepts of ajax communication
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
Eventobject is also non-standard
- 35. How do events work?
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
- 46.2.3 Fixing “callback hell” with promises
- 46.2.4 Monitoring multiple related async tasks with promises
- 46.2.1 The anatomy of a
- 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
- 45. Callbacks: The traditional approach for controlling async operations
49. Working with dates, text, XML, and JSON
- 49.1 Dates
- 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.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.2 Creating a new function from an old one
- 53.3 Calling an existing function with a new context
- 49. Working with dates, text, XML, and JSON
- About the Author
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
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), EPUB (for phones and tablets) and MOBI (for 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.
Algebra-Driven DesignSandy Maguire
A how-to field guide on building leak-free abstractions and algebraically designing real-world applications.
Production HaskellMatt Parsons
Are you excited about Haskell, but don't know where to begin? Are you thrilled by the technical advantages, but worried about the unknown pitfalls? This book has you covered.
Machine Learning EngineeringAndriy Burkov
"If you intend to use machine learning to solve business problems at scale, I'm delighted you got your hands on this book."
—Cassie Kozyrkov, Chief Decision Scientist at Google
"Foundational work about the reality of building machine learning models in production."
—Karolis Urbonas, Head of Machine Learning and Science at Amazon
The Hundred-Page Machine Learning BookAndriy Burkov
Everything you really need to know in Machine Learning in a hundred pages.
Ansible for DevOpsJeff Geerling
Ansible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
OpenIntro StatisticsDavid Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntro
A complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Cloud StrategyGregor Hohpe
While most enterprises are moving to the cloud these days, many initiatives are driven by wishes or promises rather than a sound strategy. Harvested from half a decade of cloud migrations, this book shares frameworks, strategies, and anecdotes for a structured and decision-centric path to cloud success.
Sockets and PipesType Classes
Sockets and Pipes is not an introduction to Haskell; it is an introduction to writing software in Haskell. Using a handful of everyday Haskell libraries, this book walks through reading the HTTP specification and implementing it to create a web server.
C++ Best PracticesJason Turner
Level up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Practical FP in Scala: A hands-on approachGabriel Volpe
A practical book aimed for those familiar with functional programming in Scala who are yet not confident about architecting an application from scratch.
Together, we will develop a purely functional application using the best libraries in the Cats ecosystem, while learning about design patterns and best practices.
The Node.js Bundle
3 BooksThis bundle combines three bestselling Leanpub Node.js books into a package that gives you everything you need to get started with developing Node.js applications at an unbeatable price.
The Tester's Library
8 BooksThe Tester's Library consists of eight five-star books that every software tester should read and re-read. As bound books, this collection would cost over $200. Even as e-books, their price would exceed $80, but in this bundle, their cost is only $49.99. Here are the books, and why they should be in your library: Perfect Software and Other...
11 BooksIn this bundle, you will find 10 different agile books. They are about different aspects of being agile. - finding a job - doing coding dojo's - Retrospectives - Personal kanban - a non-typical coaching book and even a book that gives you an insight in the lives of some agile people.
WTFlop 6M + HU - Beta Bundle
Fifty Quick Ideas
3 BooksGet all three books for the price of two! Fifty Quick Ideas books are full of practical, real-world techniques that you can use to improve teamwork, build better products and build them in a better way.
Growing Agile: Coach's Guide Series
4 BooksThis bundle provides a collection of training and workshop plans for a variety of agile topics. The series is aimed at agile coaches, trainers and ScrumMasters who often find themselves needing to help teams understand agile concepts. Each book in the series provides the plans, slides, handouts and activity instructions to run a number of...
Marionette.js A to Z
Complete Scala Bundle
3 BooksScala is a general-purpose programming language and it's getting extremely popular these days. Some say that learning Scala could be a challenging task. My experience, however, suggests that this is actually a myth that has very little to do with reality. With the right approach, learning Scala can be easy, fun and rewarding.The first book from...
Build A Better Backbone App
3 BooksThe best way to learn new development skills is through experience, but that takes time you don't have.Get the best of both worlds with this bundle: you'll learn how to produce modern web applications by learning from experienced developers like Derick Bailey and David Sulc. BackboneJS is one of the favorite tools on the web today, but it...