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
閱讀原始碼 - 再戰十年的 jQuery
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
高見龍
July 31, 2022
Programming
920
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
閱讀原始碼 - 再戰十年的 jQuery
- 檢視 jQuery 設計架構
- 欣賞一些有趣的寫法
- 理解設計原理後,試著復刻一個陽春版的 jQuery
高見龍
July 31, 2022
More Decks by 高見龍
See All by 高見龍
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
600
自己的售票系統自己做!
eddie
0
620
AI Agent 時代的開發者生存指南
eddie
4
2.7k
print("Hello, World")
eddie
2
650
為你自己學 Python - 冷知識篇
eddie
1
460
為你自己學 Python
eddie
0
760
Generative AI 年會小聚 - AI 教我寫程式
eddie
0
220
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
770
AI 時代的程式語言學習法
eddie
0
270
Other Decks in Programming
See All in Programming
Performance Engineering for Everyone
elenatanasoiu
0
130
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
340
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.1k
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
140
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.1k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.7k
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.4k
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
180
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
350
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Why Our Code Smells
bkeepers
PRO
340
58k
Building Adaptive Systems
keathley
44
3.1k
The Spectacular Lies of Maps
axbom
PRO
1
810
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
780
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Transcript
ޒഒላӃ ࠶ፌेɽK2VFSZ 高見龍
ޒഒላӃ ࣗզհ
ޒഒላӃ a.k.a Eddie 愛現! 喜歡冷門的玩具 開發者 / 講師 / 電腦書作者
技術推廣、教育、技術諮詢 台灣、日本等國內外技術研討會講者 部落格:https://kaochenlong.com 高見龍 @eddiekao
ޒഒላӃ 第25刷 發售中 發售中 發售中
ޒഒላӃ 已絕版
ޒഒላӃ 敬請 期待
ޒഒላӃ 歡迎加 好友
ޒഒላӃ ຊจ։࢝
ޒഒላӃ ฏৗ༗ࡏሜ+BWB4DSJQU嗎ʁ 🙋
ޒഒላӃ ᡒ說ݱࡏେՈࡏሜ7"3
ޒഒላӃ 7"37VF "OHVMBS 3FBDU
ޒഒላӃ ྃɼؐ༗ਓ
ޒഒላӃ ؐ༗ਓࡏሜK2VFSZ嗎ʁ 🙋
ޒഒላӃ શੈքࢢ佔࠷ߴతલ݅ʁ
ޒഒላӃ ૢ࡞ᖣ᧸ثత%0.݅
ޒഒላӃ ލᖣ᧸ثࢧԉʂ
ޒഒላӃ ஐܛ݁থ
ޒഒላӃ େᢇ၊ઃҰԼ w 你ಓᏓᏐత4DPQFੋॄኄ w 你ಓॄኄੋ'VODUJPO w ἦ಄വᏐ w **'&ʢ*OUFSNFEJBUF*OWPLF'VODUJPO&YQSFTTJPOʣ
w 你ಓ+BWB4DSJQUཫత݅ಋੋዎኄճࣄ w 1SPUPUZQF᪑OFXత᮫ w 你ಓUIJTዎኄ
ޒഒላӃ -JWFʂ
ޒഒላӃ ֢ॏᴍʂ
ޒഒላӃ (function(global, factory) { ...略... })(typeof window !== "undefined" ?
window : this, ...略... L14 ~ L40 IIFE 起⼿式
ޒഒላӃ ...略... ...略..., function(window, noGlobal) { ...略... return jQuery; });
L40 ~ L10880 jQuery 本體
ޒഒላӃ var version = "3.6.0", jQuery = function(selector, context) {
return new jQuery.fn.init(selector, context); }; L157 ~ L162 jQuery 定義
ޒഒላӃ var Sizzle = ( function( window ) { var
i, ...略... return Sizzle; } )( window ); L523 ~ L2978 Sizzle.js
ޒഒላӃ jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; L2982 ~ L2983
把 Sizzle 灌給 jQuery
ޒഒላӃ init = jQuery.fn.init = function( selector, context, root )
{ var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } ...略... return jQuery.makeArray( selector, this ); }; L3137 ~ L3234 初始化在這裡!
ޒഒላӃ init.prototype = jQuery.fn; L3237 讓 new 出來的 jQuery 物件,享
有整個 jQuery 的 prototype
ޒഒላӃ jQuery.event = { global: {}, add: function( elem, types,
handler, data, selector ) { ...略... } ...略... }; L5190 ~ L5607 事件處理
ޒഒላӃ ajax: function( url, options ) { if ( typeof
url === "object" ) { options = url; url = undefined; } ...略... return jqXHR; }, L9378 ~ L9824 ajax
ޒഒላӃ var _jQuery = window.jQuery, _$ = window.$; jQuery.noConflict =
function(deep) { if (window.$ === jQuery) { window.$ = _$; } if (deep && window.jQuery === jQuery) { window.jQuery = _jQuery; } return jQuery; }; L10850 ~ L10868 如果有衝突的話...
ޒഒላӃ if ( typeof noGlobal === "undefined" ) { window.jQuery
= window.$ = jQuery; } L10850 ~ L10868 把 jQuery 放到全域變數
ޒഒላӃ 歡迎加 好友