Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Benefits of Vanilla JavaScript (for the jQu...
Search
Nate Conley
September 12, 2017
Technology
0
150
The Benefits of Vanilla JavaScript (for the jQuery Developer)
Nate Conley
September 12, 2017
Tweet
Share
More Decks by Nate Conley
See All by Nate Conley
wp_enqueue_scripts
nateconley
0
46
webpack for WordPress
nateconley
0
140
Other Decks in Technology
See All in Technology
生成AIの利活用を加速させるための取り組み「prAIrie-dog」/ Shibuya_AI_1
visional_engineering_and_design
1
140
まだ間に合う! エンジニアのための生成AIアプリ開発入門 on AWS
minorun365
PRO
4
580
ハッキングの世界に迫る~攻撃者の思考で考えるセキュリティ~
nomizone
12
4.5k
個人開発から公式機能へ: PlaywrightとRailsをつなげた3年の軌跡
yusukeiwaki
11
2.7k
MC906491 を見据えた Microsoft Entra Connect アップグレード対応
tamaiyutaro
1
480
Developer Summit 2025 [14-D-1] Yuki Hattori
yuhattor
19
5.1k
『衛星データ利用の方々にとって近いようで触れる機会のなさそうな小話 ~ 衛星搭載ソフトウェアと衛星運用ソフトウェア (実物) を動かしながらわいわいする編 ~』 @日本衛星データコミニティ勉強会
meltingrabbit
0
120
モノレポ開発のエラー、誰が見る?Datadog で実現する適切なトリアージとエスカレーション
biwashi
6
770
インフラをつくるとはどういうことなのか、 あるいはPlatform Engineeringについて
nwiizo
5
2.1k
Classmethod AI Talks(CATs) #15 司会進行スライド(2025.02.06) / classmethod-ai-talks-aka-cats_moderator-slides_vol15_2025-02-06
shinyaa31
0
170
関東Kaggler会LT: 人狼コンペとLLM量子化について
nejumi
3
460
Data-centric AI入門第6章:Data-centric AIの実践例
x_ttyszk
1
370
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
A better future with KSS
kneath
238
17k
Navigating Team Friction
lara
183
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
It's Worth the Effort
3n
184
28k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
4 Signs Your Business is Dying
shpigford
182
22k
GraphQLとの向き合い方2022年版
quramy
44
13k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
29
2.2k
Docker and Python
trallard
44
3.3k
Transcript
The Benefits of Vanilla JavaScript WordCamp Sacramento 2017 1 (for
the jQuery Developer)
Hi, I’m Nate
I have a confession
I ♥ jQuery
but… sometimes I use it as a crutch
jQuery is awesome!
What do I mean by Vanilla JavaScript?
Why should I even learn Vanilla JavaScript?
Because Matt said so…
Knowing jQuery != Knowing JavaScript
Performance
operations/second Vanilla document.getElementById( ‘app’ ); 12,137,211 jQuery $( ‘#app’ )
350,557 http://vanilla-js.com/
One less dependency to load in the browser
The Future
jQuery Browser Support 1.12.4 (WordPress) - Support for IE6+ 15
3.2.1 (Current) - Support for IE9+
Fancy Frameworks and Libraries
You Might Not Need jQuery…
How Can I Start?
DOM
Selecting DOM Elements $( ‘.some-selector #here’ )
Selecting DOM Elements document.getElementById() document.querySelector() document.querySelectorAll() - Get one element
by ID selector - Get one element by CSS-like selector - Get all elements by CSS-like selector
Selecting DOM Elements document.getElementsByClassName() document.getElementsByName() document.getElementsByTagName() - Get all elements
by class selector - Get all elements by name attribute - Get all elements by HTML tag
Creating DOM Elements document.createElement() element.cloneNode() element.appendChild() - Create an element
by passing it an HTML tag - Clone an element - Append a child
More DOM Topics Traversing the DOM Form Manipulation Styles element.parentNode.firstChild
getSiblings( element ) element.value element.style.backgroundColor = ‘red’
Events
addEventListener Similar to .on(), .click(), etc. in jQuery element.addEventListener( ‘click’,
function() { // Do something } );
AJAX
XMLHttpRequest (XHR) is UGLY
var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if
( xhr.readyState == 4 && xhr.status == 200 ) { // Do something } } xhr.open( ‘GET’, ‘/wp-json/wp/v2/posts’, true ); xhr.send();
Fetch API Supported in major browsers, but no IE11 davidwalsh.name/fetch
fetch( '/wp-json/wp/v2/posts', { method: ‘GET' } ) .then( function( response ) { // Do something } ) .catch( function( error ) { // Do something } );
Live Coding! github.com/nateconley/vanilla-js
Learn More • JavaScript 30 - wesbos.com/javascript30 • Plain JS
- plainjs.com • JavaScript for WordPress - javascriptforwp.com • You Might Not Need jQuery - youmightnotneedjquery.com
Learn More • From jQuery to JavaScript - code.tutsplus.com/ tutorials/from-jquery-to-javascript-a-reference--
net-23703 • Sans jQuery - gist.github.com/joyrexus/7307312 • Wes Bos Resources - wesbos.com/learn-javascript/ • Parallax Done Right - medium.com/@dhg/parallax- done-right-82ced812e61c
@nateconley123 nateconley.com