Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

jQuery vs Pure Javascript with Olivier Buisard

212 views

Published on

Presented at JoomlaDay Chicago 2019
Joomla 4 is on the horizon and will be closer than ever to the standards of the modern web. Underlying scripts will not rely on external libraries any longer, reducing dependencies for the years ahead. For small javascript tasks, writing directly to the DOM may be faster than relying on libraries such as jQuery.

In this hands-on session, we will see how small jQuery tasks can be easily rewritten with plain javascript.

Published in: Software
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

jQuery vs Pure Javascript with Olivier Buisard

  1. 1. 
 
 JQUERY VS PURE JAVASCRIPT OLIVIER BUISARD OCTOBER 2019
  2. 2. Olivier Buisard A BIT OF HISTORY 10/11/2019 1995 061999 2012 2015090720051997 08 ES3 jScript AJAX 1.5 3.0 ES5 ES6
  3. 3. Olivier Buisard TODAY • Matured standards • Wide support • ‘Death’ of old browsers (IE6-8) 10/11/2019
  4. 4. Olivier Buisard JQUERY ADVANTAGES AND DRAWBACKS • Written in JavaScript • Supports old browsers • Code simplification, chaining • Many available plugins • Extra library file including features you may not need • Possible conflicts with other libraries • Heavy to operate on mobile devices • Overuse and inefficiency 10/11/2019
  5. 5. Olivier Buisard ADVANTAGES IN LEARNING TODAY’S PURE JAVASCRIPT • Fast (native to the browsers) • Clean, efficient code • Helps understand jQuery underlying code 10/11/2019
  6. 6. Olivier Buisard SEPARATION AND DELEGATION • HTML: the structure (content, buttons, links) • CSS: the visual, the interactivity, the layout • JavaScript: the loading of content on demand (AJAX), the event listeners (for touch, clicks and scroll…) 10/11/2019
  7. 7. Olivier Buisard DOCUMENT READY 10/11/2019 jQuery(document).ready(function($) { // do something }); document.addEventListener("DOMContentLoaded", function() { // do something });
  8. 8. Olivier Buisard SELECTING ELEMENTS – ‘$’ 10/11/2019 $(".tile"); $("#mytile"); // select the first instance of .tile document.querySelector(".tile"); 
 // select all instances of .tile document.querySelectorAll(".tile"); 
 // select ‘the’ instance of #mytile document.getElementById("mytile");
  9. 9. Olivier Buisard USING SELECTED ELEMENTS 10/11/2019 $(".tile").hide(); document.querySelectorAll(".tile").forEach(function(tile) { tile.style.display = "none"; });
  10. 10. Olivier Buisard TRAVERSING THE TREE 10/11/2019 var tile = $(".tile"); tile.next(); tile.prev(); tile.parent(); var tile = document.querySelector(".tile"); tile.nextElementSibling; tile.previousElementSibling; tile.parentElement;
  11. 11. Olivier Buisard WORKING WITH THE DOM 10/11/2019 // Create a div and add text var element = $("<div/>"); element.text("This is just text"); // Create a div and add text var element = document.createElement("div"); var text = document.createTextNode("This is just text"); element.appendChild(text);
  12. 12. Olivier Buisard USING CLASSES 10/11/2019 var tile = document.querySelector(".tile"); tile.classList.add("active"); tile.classList.remove("active"); tile.classList.toggle("active"); if (tile.classList.contains("active")) { // Do something... } var tile = $(".tile"); tile.addClass("active"); tile.removeClass("active"); tile.toggleClass("active"); if (tile.hasClass("active")) { // Do something... }
  13. 13. Olivier Buisard WORKING WITH EVENTS 10/11/2019 $(".button").click(function(e) { // Do something... }); $(".tile").trigger("myEvent"); document.querySelector(".button") .addEventListener("click", function(e) { // Do something... }); document.querySelector(".tile") .dispatchEvent(new Event("myEvent"));
  14. 14. Olivier Buisard AJAX 10/11/2019 $.ajax({ url: "data.json" }).done(function(data) { // Handle data }).fail(function() { // Handle error }); fetch("data.json") .then(function(data) { // Handle data }) .catch(function(error) { // Handle error });
  15. 15. Olivier Buisard LIVE EXAMPLE 10/11/2019
  16. 16. Olivier Buisard 010/11/2019 Make sure that no one will be blocked by using an older browser if they don’t get all interactions that are meant for a new technology
  17. 17. Olivier Buisard CAN I USE ? 10/11/2019
  18. 18. Olivier Buisard BABELJS.IO 10/11/2019
  19. 19. Olivier Buisard POLYFILL.IO 10/11/2019
  20. 20. Olivier Buisard YOUR OWN POLYFILL 10/11/2019 if (!Array.prototype.push) { // Check if not already supported, then only add. // No need to check this when you want to Override the method // Add method to prototype of array, // so that it can be directly called on array Array.prototype.push = function() { // Use loop for multiple/any no. of elements for (var i = 0; i < arguments.length; i++) { this[this.length] = arguments[i]; } // Return new length of the array return this.length; }; }
  21. 21. Olivier Buisard SHOULD I GET RID OF JQUERY? • In Joomla 3, if the template uses Bootstrap 2, 3 or 4, jQuery is included • For complex interactions (ie slider), use jQuery • For simpler code, go with pure JavaScript • Joomla 4 is slowly becoming jQuery independent • Bootstrap 5 will not require jQuery 10/11/2019
  22. 22. Olivier Buisard REFERENCES • youmightnotneedjquery.com • tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript • javascript.info (modern JavaScript tutorial) • github.com/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript • caniuse.com • babeljs.io • polyfill.io 10/11/2019
  23. 23. Olivier Buisard OLIVIER.BUISARD@SIMPLIFYYOURWEB.COM
 @SIMPLIFYYOURWEB THANK YOU! 10/11/2019

×