Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
The Benefits of Vanilla JavaScript (for the jQu...
Search
Nate Conley
September 12, 2017
Technology
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The Benefits of Vanilla JavaScript (for the jQuery Developer)
Nate Conley
September 12, 2017
Transcript
34 slides
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
More Decks by Nate Conley
See All by Nate Conley
wp_enqueue_scripts
nateconley
0
55
webpack for WordPress
nateconley
0
150
Other Decks in Technology
See All in Technology
猫でもわかるKiro初心者編(2026年11月版)
kentapapa
1
140
リリースしたで終わらない。 観測できるフロントエンド開発
yamakenji24
4
2k
Is the Website Dying?
miriamschwab
0
290
AWS DevOps Agentの構造から読み解く運用 AI エージェントの設計原則/aws-devops-agent-design-principles
tomoki10
0
330
コーディングできない僕にBobが舞い降りた
shumpei3
0
270
AI時代に問い直す「プロダクションミーティング」の価値 〜チームでサービスの信頼性を高める取り組み〜
mackerelio
0
240
AI時代のTechLeadの問い〜Tech Lead Conference 2026 Autumn / questions-for-tech-leads-in-the-age-of-ai
haru860
0
120
ブース設計、 お前もプロダクトだったのか / So Booth Design Was a Product All Along
akihiro0038
0
200
Kiro Crew の Conductor mode: 1 つのチャットに渡したゴールを、コンダクターがワーカーに分けて任せる
inariku
PRO
1
150
Kiro Enterprise Management: 管理者が 1 か所で決め、全員の Kiro に届ける
inariku
PRO
1
180
メルカリの小規模チーム「Pod」で、 エンジニアがデータアナリストなしで、 AIを使ってデータ分析の自走を目指す取り組み
jackojacko_
1
400
メディアアートを〈拡張〉する——器官学と個体化論を手がかりに
_kotobuki_
1
420
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
A better future with KSS
kneath
240
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Building an army of robots
kneath
307
47k
Facilitating Awesome Meetings
lara
57
7.2k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
Large-scale JavaScript Application Architecture
addyosmani
516
110k
RailsConf 2023
tenderlove
30
1.6k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.2k
Faster Mobile Websites
deanohume
310
32k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.9k