SlideShare a Scribd company logo
SO LONG, JQUERY, AND THANKS FOR 
ALL THE FISH! 
MATT TURNURE 
github.com/MattTurnure 
@MattTurnure 
mattturnure.com
I LOVE NATIVE, CORE JAVASCRIPT BECAUSE … 
1. We are living in modern times. 
Support for older browsers are dwindling. 
2. It’s more performant. 
Core JavaScript is faster than jQuery in many cases. 
3. jQuery uses it.
THINGS I HAVE USED JQUERY FOR 
1. Selectors 
2. Class Manipulation 
3. Loops 
4. Event Modeling 
5. Animation 
6. Ajax
SELECTORS
SELECTING INDIVIDUAL DOM NODES
$('#my-id') 
versus 
document.querySelector('#my-id')
http://jsperf.com/node-selectors-2
SELECTING MULTIPLE DOM NODES
$('.my-class') 
versus 
document.querySelectorAll('.my-class')
http://jsperf.com/node-selectors/3
BONUS CORE SELECTOR SHOWDOWN
document.querySelector('#my-id') 
versus 
document.getElementById('my-id')
http://jsperf.com/core-selector
document.querySelectorAll('.my-class') 
versus 
document.getElementsByClassName('my-class')
http://jsperf.com/core-class-selectors
BROWSER SUPPORT 
< IE8 is not supported. IE8 has partial support. Partial support in 
IE8 is due to being limited to CSS 2.1 selectors. Additionally, it will 
have trouble with selectors including unrecognized tags (for 
example HTML5 ones). 
http://caniuse.com/#search=querySelectorAll 
http://caniuse.com/#search=getElementsByClassName 
FURTHER READING 
https://developer.mozilla.org/en- 
US/docs/Web/API/Document.querySelectorAll 
https://developer.mozilla.org/en- 
US/docs/Web/API/document.getElementsByClassName 
https://developer.mozilla.org/en- 
US/docs/Web/API/document.getElementById
CLASS MANIPULATION
HASCLASS 
.hasClass() 
versus 
el.classList.contains()
$el.hasClass() 
var $el = $('#item'); 
if ($el.hasClass('item')) { 
return true; 
} else { 
return false; 
}
el.classList.contains() 
var el = document.getElementById('item'); 
if (el.classList.contains('item')) { 
return true; 
} else { 
return false; 
}
http://jsperf.com/hasclass-performance
ADDCLASS 
.addClass() 
versus 
el.classList.add()
$el.addClass() 
$('#item').addClass('added');
el.classList.add() 
document.getElementById('item').classList.add('added');
http://jsperf.com/turnureaddclass
REMOVECLASS 
.removeClass() 
versus 
el.classList.remove()
$el.removeClass() 
$('#item').removeClass('added');
el.classList.remove() 
document.getElementById('item').classList.remove('added');
http://jsperf.com/removeclass-vs-classlist-remove
BROWSER SUPPORT 
<= IE9 and Opera Mini not supported 
http://caniuse.com/#search=classList 
FURTHER READING 
https://developer.mozilla.org/en- 
US/docs/Web/API/Element.classList
LOOPS
$.each() 
versus 
arr.forEach()
$.each() 
var $list = $('ul li'); 
$.each($list, function (i, val) { 
// do something with val 
});
arr.forEach() 
var list = document.querySelectorAll('ul li'), 
ary = Array.prototype.slice.call(list); 
ary.forEach(function (item) { 
// do something with item 
});
http://jsperf.com/turnure-loops
BROWSER SUPPORT 
>= IE9 
http://kangax.github.io/compat-table/ 
es5/#Array.prototype.forEach 
FURTHER READING 
https://developer.mozilla.org/en- 
US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
EVENT MODELING
$el.on() 
versus 
el.addEventListener()
$el.on() 
var $list = $('#list'); 
function func() {} 
$list.on('click', func); 
$list.off('click', func);
el.addEventListener() 
var list = document.getElementById('list'); 
function func() {} 
list.addEventListener('click', func, false); 
list.removeEventListener('click', func, false);
http://jsperf.com/event-model/2
BROWSER SUPPORT 
>= IE9 
https://developer.mozilla.org/en- 
US/docs/Web/API/EventTarget.addEventListener
ANIMATION 
CSS3 Transitions
AJAX 
Only use the parts of jQuery that you need. 
https://github.com/jquery/jquery 
$ grunt custom:-core/ready,-css,-effects,-deprecated,-dimensions,-event/alias,-offset,-wrap
MATT TURNURE 
github.com/MattTurnure 
@MattTurnure 
mattturnure.com

More Related Content

PDF
How Kris Writes Symfony Apps
Kris Wallsmith
 
PDF
How kris-writes-symfony-apps-london
Kris Wallsmith
 
PDF
Matters of State
Kris Wallsmith
 
PDF
How Kris Writes Symfony Apps
Kris Wallsmith
 
PDF
Introduction to jQuery
Nivedhitha Venugopal
 
PPT
jQuery 1.7 Events
dmethvin
 
PPTX
jQuery Best Practice
chandrashekher786
 
PDF
jQuery and Rails, Sitting in a Tree
adamlogic
 
How Kris Writes Symfony Apps
Kris Wallsmith
 
How kris-writes-symfony-apps-london
Kris Wallsmith
 
Matters of State
Kris Wallsmith
 
How Kris Writes Symfony Apps
Kris Wallsmith
 
Introduction to jQuery
Nivedhitha Venugopal
 
jQuery 1.7 Events
dmethvin
 
jQuery Best Practice
chandrashekher786
 
jQuery and Rails, Sitting in a Tree
adamlogic
 

What's hot (20)

PPT
Javascript and jQuery intro
waw325
 
PPTX
Bacbkone js
Артём Курапов
 
PDF
Drupal, meet Assetic
Kris Wallsmith
 
PDF
Jqeury ajax plugins
Inbal Geffen
 
PDF
Love and Loss: A Symfony Security Play
Kris Wallsmith
 
PDF
DOM Scripting Toolkit - jQuery
Remy Sharp
 
PPTX
AngularJS Routing
Eyal Vardi
 
KEY
amsterdamjs - jQuery 1.5
mennovanslooten
 
PDF
Functionality Focused Code Organization
Rebecca Murphey
 
PDF
An Introduction to Jquery
Phil Reither
 
KEY
jQuery Anti-Patterns for Performance & Compression
Paul Irish
 
PDF
Javascript Frameworks for Joomla
Luke Summerfield
 
PPT
jQuery
Mohammed Arif
 
PDF
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
KEY
Sprout core and performance
Yehuda Katz
 
PPT
Kick start with j query
Md. Ziaul Haq
 
PDF
jQuery - 10 Time-Savers You (Maybe) Don't Know
girish82
 
PPT
Jquery Best Practices
brinsknaps
 
PPTX
FuncUnit
Brian Moschel
 
PDF
Real Time App with Node.js
Jxck Jxck
 
Javascript and jQuery intro
waw325
 
Drupal, meet Assetic
Kris Wallsmith
 
Jqeury ajax plugins
Inbal Geffen
 
Love and Loss: A Symfony Security Play
Kris Wallsmith
 
DOM Scripting Toolkit - jQuery
Remy Sharp
 
AngularJS Routing
Eyal Vardi
 
amsterdamjs - jQuery 1.5
mennovanslooten
 
Functionality Focused Code Organization
Rebecca Murphey
 
An Introduction to Jquery
Phil Reither
 
jQuery Anti-Patterns for Performance & Compression
Paul Irish
 
Javascript Frameworks for Joomla
Luke Summerfield
 
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
Sprout core and performance
Yehuda Katz
 
Kick start with j query
Md. Ziaul Haq
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
girish82
 
Jquery Best Practices
brinsknaps
 
FuncUnit
Brian Moschel
 
Real Time App with Node.js
Jxck Jxck
 
Ad

Similar to So long, jQuery, and thanks for all the fish! (20)

PDF
Building Large jQuery Applications
Rebecca Murphey
 
PDF
jQuery secrets
Bastian Feder
 
PPTX
Анатолий Поляков - Drupal.ajax framework from a to z
LEDC 2016
 
PDF
jQuery
Andrew Homeyer
 
PDF
Understanding backbonejs
Nick Lee
 
PDF
Virtual Madness @ Etsy
Nishan Subedi
 
PDF
international PHP2011_Bastian Feder_jQuery's Secrets
smueller_sandsmedia
 
KEY
jQuery Anti-Patterns for Performance
András Kovács
 
KEY
Advanced jQuery
sergioafp
 
PPTX
What mom never told you about bundle configurations - Symfony Live Paris 2012
D
 
ODP
JQuery introduction
Pradeep Saraswathi
 
PDF
Javascript in Plone
Steve McMahon
 
PPTX
Useful things to do with jQuery
James Bubb
 
PDF
Why Our Code Smells
TiNguyn863920
 
PDF
Drupal & javascript
Almog Baku
 
PDF
SilverStripe CMS JavaScript Refactoring
Ingo Schommer
 
PDF
06 jQuery #burningkeyboards
Denis Ristic
 
KEY
Bcblackpool jquery tips
Jack Franklin
 
PDF
jQuery secrets
Bastian Feder
 
PDF
Cheap frontend tricks
ambiescent
 
Building Large jQuery Applications
Rebecca Murphey
 
jQuery secrets
Bastian Feder
 
Анатолий Поляков - Drupal.ajax framework from a to z
LEDC 2016
 
Understanding backbonejs
Nick Lee
 
Virtual Madness @ Etsy
Nishan Subedi
 
international PHP2011_Bastian Feder_jQuery's Secrets
smueller_sandsmedia
 
jQuery Anti-Patterns for Performance
András Kovács
 
Advanced jQuery
sergioafp
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
D
 
JQuery introduction
Pradeep Saraswathi
 
Javascript in Plone
Steve McMahon
 
Useful things to do with jQuery
James Bubb
 
Why Our Code Smells
TiNguyn863920
 
Drupal & javascript
Almog Baku
 
SilverStripe CMS JavaScript Refactoring
Ingo Schommer
 
06 jQuery #burningkeyboards
Denis Ristic
 
Bcblackpool jquery tips
Jack Franklin
 
jQuery secrets
Bastian Feder
 
Cheap frontend tricks
ambiescent
 
Ad

Recently uploaded (20)

PPTX
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PPTX
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
PPTX
AI ad its imp i military life read it ag
ShwetaBharti31
 
PDF
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
PDF
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
PDF
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
PPTX
Parallel & Concurrent ...
yashpavasiya892
 
PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PPTX
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
PPTX
Different Generation Of Computers .pptx
divcoder9507
 
PPT
Transformaciones de las funciones elementales.ppt
rirosel211
 
PDF
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PPTX
Artificial-Intelligence-in-Daily-Life (2).pptx
nidhigoswami335
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PPTX
Black Yellow Modern Minimalist Elegant Presentation.pptx
nothisispatrickduhh
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
AI ad its imp i military life read it ag
ShwetaBharti31
 
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
Parallel & Concurrent ...
yashpavasiya892
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
Different Generation Of Computers .pptx
divcoder9507
 
Transformaciones de las funciones elementales.ppt
rirosel211
 
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
Artificial-Intelligence-in-Daily-Life (2).pptx
nidhigoswami335
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
Black Yellow Modern Minimalist Elegant Presentation.pptx
nothisispatrickduhh
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 

So long, jQuery, and thanks for all the fish!