Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
The purification of web development
Nicolas Gallagher
May 30, 2013
Programming
5
310
The purification of web development
Nicolas Gallagher
May 30, 2013
Tweet
Share
More Decks by Nicolas Gallagher
See All by Nicolas Gallagher
React Native for web and beyond
necolas
5
910
Thinking beyond "Scalable CSS"
necolas
14
6.6k
Making Twitter UI Infrastructure
necolas
14
3.5k
Adaptation and Components
necolas
6
950
CSS Application Architecture
necolas
15
520
HTML5 Boilerplate: past, present, and future
necolas
4
230
Other Decks in Programming
See All in Programming
Hono v3 - Do Everything, Run Anywhere, But Small, And Faster
yusukebe
4
130
はてなリモートインターンシップ2022 フロントエンドブートキャンプ 講義資料
hatena
0
120
23年のJavaトレンドは?Quarkusで理解するコンテナネイティブJava
tatsuya1bm
1
120
フロントエンドで学んだことをデータ分析で使ってみた話
daichi_igarashi
0
170
まだ日本国内で利用できないAppActionsにトライしてみた / MoT TechTalk #15
mot_techtalk
0
110
LIFFで動く割り勘アプリTATEKAをリリースしてみた話
inoue2002
0
230
Zynq MP SoC で楽しむエッジコンピューティング ~RTLプログラミングのススメ~
ryuz88
0
320
Refactor with using `available` and `deprecated`
417_72ki
3
380
Hasura の Relationship と権限管理
karszawa
0
160
フロントエンドで 良いコードを書くために
t_keshi
3
1.6k
How to Fight Production Incidents?
asatarin
0
170
ポケモンで学ぶiOS 16弾丸ツアー 🚅
giginet
PRO
1
610
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
10
1.3k
Code Reviewing Like a Champion
maltzj
508
38k
Clear Off the Table
cherdarchuk
79
290k
Practical Orchestrator
shlominoach
178
8.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
50k
5 minutes of I Can Smell Your CMS
philhawksworth
198
18k
JazzCon 2018 Closing Keynote - Leadership for the Reluctant Leader
reverentgeek
175
9.1k
Bootstrapping a Software Product
garrettdimon
299
110k
Fireside Chat
paigeccino
16
1.8k
No one is an island. Learnings from fostering a developers community.
thoeni
12
1.5k
How To Stay Up To Date on Web Technology
chriscoyier
779
250k
Web Components: a chance to create the future
zenorocha
304
40k
Transcript
The purification of web development
Nicolas Gallagher @necolas
Before code…
Assumptions and the history of ideas
Heraclitus (535 BC – 475 BC)
None
Democritus (460 BC – 370 BC)
None
None
“You cannot step twice into the same river; for fresh
waters are flowing in upon you.” – Heraclitus
CSS and the purification of HTML
<table> <tr> <td align="left" onClick="dothing()"> <center> <font face="verdana">…</font> </center> </td>
</tr> </table>
“To increase the granularity of control over elements, a new
attribute has been added to HTML: 'CLASS'.” - CSS1 spec
None
Don’t use “unsemantic” class names?
“Your HTML, like diamonds, should be forever.” - camendesign.com
“…authors are encouraged to use [class attribute] values that describe
the nature of the content, rather than values that describe the desired presentation of the content.” - HTML5 spec
“A structure based on CLASS is only useful within a
restricted domain, where the meaning of a class has been mutually agreed upon.” - CSS1 spec
Class names are for us, not machines
We can pick our own meaning
Don't write ugly class names?
<p class="hyphens-as-word-separators"> … </p>
/* Component */ .button {…} /* Component */ .button-group {…}
/* Component modifier */ .button.primary {…} /* Component child */ .button-group .item {…}
/* Component */ .Button {…} /* Component modifier */ .Button--primary
{…} /* Component */ .ButtonGroup {…} /* Component descendant */ .ButtonGroup-item {…}
<!-- HTML --> <ul class="ButtonGroup"> <li class="ButtonGroup-item"> <button class="Button"> Save
</button> </li> <li class="ButtonGroup-item"> <button class="Button Button--cancel"> Cancel </button> </li> </ul>
None
github.com/necolas/suit-button-group
github.com/necolas/suit
Structured class names are useful
Don’t use extra elements?
<article class="Box"> <div class="Box-close"> <button class="u-textLike js-close"> <span class="Icon Icon--close"></span>
<span class="u-isHiddenVisually"> Close </span> </button> </div> ... </article>
<article class="Box"> <div class="Box-close"> {{> partials/close-button }} </div> {{$content}}{{/content}} </article>
{{<box_with_close}} {{$content}} <h1>Title</h1> <p>Some words</p> {{/content}} {{/box_with_close}}
Look at what they make you give
Web Components
“Web Components…let web application authors define widgets with a level
of visual richness not possible with CSS alone” - W3C Introduction to Web Components
“…specify the extra presentation using markup…” - W3C Introduction to
Web Components
None
Encapsulation, interoperability, reuse
Shadow DOM Encapsulation and DOM boundaries <element> Custom elements; extend
native elements <template> Clonable, inert DOM fragments
<element extends="button" name="x-btnClose"> <template> <style> @host { /* css to
unstyle button */ } .visHidden { /* css to hide text */ } </style> <x-icon type="close" size="24"></x-icon> <div class="visHidden"> <content></content> </div> </template> <script>// javascript</script> </element>
<button is="x-btnClose">Close</button>
None
It’s ok to rely on extra elements
Step back into the river
The end