In the first part of this lesson you saw how to improve the performance of code that uses jQuery by selecting elements the right way. We discussed when to take advantage of the context parameter of jQuery() and when to avoid its use. We also covered how to avoid using the Universal selector. Later you learned how to achieve better performance in older browsers by creating selectors that allow jQuery to call JavaScript native functions like getElementById() and getElementsByClassName().
No library or framework is magic. Remember that when you use third-party software, even a powerful one like jQuery, it makes some optimizations on your behalf, but others are your responsibility.
In the second main section we introduced you to the importance of keeping your code base clean and organized. We taught you what a module is and some of the patterns available to split your code, written using jQuery (but not limited to this case only), in modules. Among the advantages of this approach is that you have the possibility of creating “private” variables and functions and avoiding polluting the global scope.
A tool we presented is RequireJS, a JavaScript file and module loader for different environments. This library frees you from the burden of manually sorting modules, libraries, and frameworks based on their dependencies. In its section, we covered how to develop modules to take advantage of RequireJS and showed how you can adapt existing JavaScript code to work with it. Specifically, we showed you how to use an existing jQuery plugin with RequireJS without changing its source through the use of a simple configuration file.
Another tool we described is Bower. It’s a package manager for the web that empowers you to manage your JavaScript, CSS, and other types of dependencies including jQuery. You saw how you can search a package your application may need through the use of the CLI. Then you also learned how to install, update, and delete a package using Bower.
In the last part of this lesson you learned about Backbone.js, one of the MV* frameworks available in the JavaScript world. Backbone.js enables you to create single-page applications (SPAs), a type of application widely employed today that helps developers to reduce the backend of complex applications to a minimum. In fact, most of the business logic is written in JavaScript and resides on the client side. The section dedicated to Backbone.js showed you what a possible next step is now that you know all about jQuery. In addition, this framework integrates well with jQuery to enable you to develop amazing applications.
We also discussed the architecture and main concepts of Backbone.js: models, routers, views, templates, and collections. Then we put it all together to develop a basic application to keep your daily activities organized, called Todos manager.
Oh my! How much time has passed since the start of this app! It has been an incredible experience for us to offer you the best resource possible, and we really hope to have achieved our goal. We’re sure that it has been an incredible journey for you as well, and that you’ve had some moments of discouragement in the attempt to remember the huge amount of information we’ve provided. If you can’t recall every function we explained or the list of arguments accepted by a function, don’t worry: there’s nothing wrong with that. Experience, practice, and a tab of your browser constantly pointing to the jQuery documentation can solve this issue.
jQuery is a constantly evolving project, and it’s subject to numerous updates, additions, deprecation, and even feature deletions as you’ve discovered by reading the changes brought by jQuery 3. Sometimes it’s hard to catch up with all the news, the updates introduced by the team in every release of the library and the documentation, and the bugs found.
In this app we tried hard to offer you the most up-to-date information pertaining to the functions and the properties offered by jQuery, the best practices adopted by the web community, and also some advanced programming techniques.
We hope you’ve enjoyed this app and that you won’t stop learning. We also wish you health and happiness, and may all your bugs be easily solvable!
Leave a Reply