SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Downloaden Sie, um offline zu lesen
<change your markup,
                   change your life/>
                          <!-- not another html5 talk -->




Saturday, June 11, 2011
o/
                          garann means / @garannm / garann.com




Saturday, June 11, 2011
famous progressive
                          enhancement m&m




                                      http://www.alistapart.com/articles/understandingprogressiveenhancement/
Saturday, June 11, 2011
removing the peanut
                          == bad




                                    http://www.flickr.com/photos/npj/2681920153/
Saturday, June 11, 2011
html
                     </>   is code
                     </>   is content
                     </>   is understood by all browsers
                          </>   let’s see your fancy-pants [popular
                                programming language] do that!




Saturday, June 11, 2011
html the way nature
                           intended




Saturday, June 11, 2011
use what you have
                     </>   inline-block
                     </>   numbered lists
                     </>   navigation between pages
                     </>   editable fields
                     </>   label-input relationships
                     </>   form submission




Saturday, June 11, 2011
this
                <img src=”gozer.jpg” alt=”photo of my dog” />




Saturday, June 11, 2011
makes this




Saturday, June 11, 2011
easier than this
                <div class=”photo”>photo of my dog</div>
                <div class=”ttip”></div>
                ...
                .photo { height: 400px; text-indent: ... }
                .ttip { display: none; position: ... }
                ...
                $(“div.photo”).mouseover(function() {
                 var $t = $(this), alt = $t.text(),
                   p = $t.position(), tt = $(“div.ttip”);
                 tt.css({top:p.top,left:p.left})
                   .text(alt).show();
                })
                .mouseout(function() {
                 $(“div.ttip”).hide();
                });
Saturday, June 11, 2011
this
                <select>
                 <option>give you up</option>
                 <option>let you down</option>
                 <option>run around and desert you</option>
                 <option>make you cry</option>
                 <option>say goodbye</option>
                 <option>tell a lie and hurt you</option>
                </select>




Saturday, June 11, 2011
makes this




Saturday, June 11, 2011
easier than this
                <input type=”text” class=”dropdown” id=”my-dd”/>
                <ul class=”dropdown-list” data-dd=”my-dd”>
                 <li>give you up</li>
                 <li>let you down</li>
                 <li>run around and desert you</li>
                 <li>make you cry</li>
                 <li>say goodbye</li>
                 <li>tell a lie and hurt you</li>
                </ul>
                ...
                .dropdown-list { border: 1px solid #ccc; ...}
                ...
                $(“input.dropdown”).focus( ... ).blur( ... );
                $(“ul.dropdown-list li”).click( ... );

Saturday, June 11, 2011
don’t screw with the
                                baseline
                     </>   too much resetting
                     </>   too many generic event handlers
                     </>   too many elements doing the wrong thing
                     </>   == too much work




Saturday, June 11, 2011
markup
                <div class=”user-content”>
                 ...
                 <ul>
                   <li>A list</li>
                   <li>With stuff in it</li>
                   <li>That has bullets :O</li>
                 </ul>
                 ...
                </div>




Saturday, June 11, 2011
..made more difficult
                ul, ol { list-style-type: none; }
                ...
                .user-content ul { list-style-type: disc; }
                .user-content ul ul { list-style-type: circle; }
                ...
                .user-content ol { list-style-type: decimal; }
                .user-content ol ol { list-style-type: lower-roman; }




Saturday, June 11, 2011
overwrite only when
                         necessary
                     </>   bullets on lists
                     </>   margins on paragraphs
                     </>   onsubmit=”return false;”
                     </>   preventDefault() to use a link
                     </>   links that link somewhere
                     </>   http://necolas.github.com/normalize.css




Saturday, June 11, 2011
polyfills not plugins
                     </>   use the right solution
                     </>   build now for the future
                     </>   take advantage of html
                          </>   (even if it doesn’t exist yet)




Saturday, June 11, 2011
this
                <input type=”text” placeholder=”Type here” />




Saturday, June 11, 2011
instead of this
                <input type=”text” class=”plchldr” />
                <span class=”plchldr-txt”>Type here</span>
                ...
                $(“input.plchldr”).each(function() {
                 var $t = $(this);
                 $t.text($t.next().text())
                   .addClass(“plchldr-empty”);
                 $t.focus(function() {
                   $t.text(“”).removeClass(“plchldr-empty”)
                 });
                 ...
                });




Saturday, June 11, 2011
*except for this
                $(“.ie7 input[placeholder]”).each(function() {
                 var $t = $(this);
                 $t.text($t.attr(“placeholder”))
                   .addClass(“plchldr-empty”);
                 $t.focus(function() {
                   $t.text(“”).removeClass(“plchldr-empty”)
                 });
                 ...
                });




Saturday, June 11, 2011
design patterns for
                               markup




Saturday, June 11, 2011
homes for htmls
                     </>   includes
                          </>   unrelated single-use pieces
                     </>   server-side templates
                          </>   compositions of elements
                     </>   client-side templates
                          </>   enhancements




Saturday, June 11, 2011
once it’s on the client
                     </>   common stuff in the page
                     </>   rarer stuff on demand
                     </>   smaller pieces as js vars
                     </>   don’t load anything more than once




Saturday, June 11, 2011
all OOP everything
                     </>   js isn’t object-oriented
                          </>   but we make it that way
                     </>   machine code: also not object-oriented
                          </>   we use abstractions
                     </>   html: not object-oriented
                          </>   or even a programming language
                          </>   MOAR ABSTRACTIONS



Saturday, June 11, 2011
singleton-ish
                     </>   create markup once you need it
                     </>   save private reference
                     </>   treat rendering as instantiation
                     </>   expose specific functionality




Saturday, June 11, 2011
singleton-ish
                app.Tooltip = {
                 _tt: $(“#tooltip”),
                 render: function(txt,pos) {
                   if (!this._tt.length) {
                     this._tt = $(‘<div id=”tooltip”>’)
                      .appendTo(‘body’);
                   }
                   this._tt.text(txt);
                   this._tt.css({left:pos.left,top:pos.top}).show();
                 },
                 hide: function() {
                   this._tt.hide();
                 }
                };

Saturday, June 11, 2011
factory-ish
                     </>   get markup once it’s needed
                     </>   same function for
                          </>   render once (e.g., init)
                          </>   add more




Saturday, June 11, 2011
factory-ish
                app.Address = {
                 _html: null,
                 addNew: function(container) {
                   if (this._html) container.append(this._html);
                   else this._load(container);
                 },
                 _load: function(container) {
                   var that = this;
                   $.get(“addrTemplate.html”,function(tmpl) {
                    that._html = $.tmpl(tmpl,null);
                    that.addNew(container);
                   });
                 }
                };

Saturday, June 11, 2011
markup in your
                                  modules
                     </>   js != module
                     </>   js + css + markup == module
                          </>   data and functionality
                          </>   appearance
                          </>   actual interface




Saturday, June 11, 2011
markup in your
                            modules
                app.myObj = function () {
                 that = {
                   _props: {},
                   init: function() { ... },
                   save: function() { ... },
                   _render: function() {
                     // e.g. factory goes here
                     ...
                   }
                 };
                 return that;
                };




Saturday, June 11, 2011
markup needs its own
                     controllers
                     </>   everything is not a module
                     </>   rendering
                          </>   multiple ways
                     </>   event handling
                     </>   state management




Saturday, June 11, 2011
markup needs its own
                     controllers
                $(document).ready(function() {
                 $(“form”).hide();
                 $(“#submitThingy”).live(“click”,function() {
                   var f = $(“form”);
                   $.post(f.attr(“action”),f.serialize(),function() {
                    f.hide();
                   });
                 });
                 $(“#editButton”).live(“click”,function() {
                   $(“form”).show();
                 });
                });




Saturday, June 11, 2011
markup needs its own
                     controllers
                app.page = {
                 aForm: $(“form”),
                 init: function() {
                   this.aForm.hide();
                   $(“#editButton”).live(“click”,that.edit);
                 },
                 edit: function() {
                   this.aForm.show();
                   $(“#submitThingy”).click(that.save);
                 },
                 save: function() {
                   $.post( ... );
                 }
                };
                app.page.init();
Saturday, June 11, 2011
this is your job




Saturday, June 11, 2011
go fast or go home
                <div class=”bottomRight”>
                 <div class=”bottomLeft”>
                   <div class=”topRight”>
                    <div class=”topLeft”>
                      <p>WTF, really??</p>
                    </div>
                   </div>
                 </div>
                </div>
                ...
                <!-- plus the images, plus the css -->




Saturday, June 11, 2011
go fast or go home
                     </>   dowebsitesneedtolookexactlythesameinevery
                           browser.com/
                          </>   no
                     </>   markup weight
                     </>   non-markup weight
                     </>   speed vs. pixel perfection




Saturday, June 11, 2011
look better naked
                <strong>Please fill out this form</strong>
                <label>Name: </label>
                <input type=”text” id=”txtName” />
                <label>Email: </label>
                <input type=”text” id=”txtEmail” />
                <label>State: </label>
                <select id=”selState”>
                 <option>Texas</option>
                 <option>Not Texas</option>
                </select>




Saturday, June 11, 2011
look better naked
                <h1>Please fill out this form</h1>
                <form action=”/url” method=”POST”>
                 <label>Name:
                   <input type=”text” id=”txtName” />
                 </label><br/>
                 <label>Email:
                   <input type=”text” id=”txtEmail” />
                 </label><br/>
                 <label>State:
                   <select id=”selState”>
                    <option>Texas</option>
                    <option>Not Texas</option>
                   </select>
                 </label>
                </form>
Saturday, June 11, 2011
look better naked
                     </>   presentational markup is bad
                          </>   (it says so on the internet)
                     </>   presentational markup is good for
                           presentation
                     </>   is it in the standards?
                     </>   manage the trade-offs




Saturday, June 11, 2011
js + css shouldn’t have
                         to share
                <div class=”coolModule”>
                 <img src=”aFace.jpg” alt=”J. User” />
                 <h3>J. User said:</h3>
                 <p>What if I want coolModule to behave differently
                   sometimes? Or what if I don’t want to override
                   the style to use the same functionality with a
                   different look?</p>
                </div>




Saturday, June 11, 2011
js + css shouldn’t have
                         to share
                <div class=”comment expandable” id=”mostRecent”>
                 <img src=”aFace.jpg” alt=”J. User” />
                 <h3>J. User said:</h3>
                 <p>What if I want coolModule to behave differently
                   sometimes? Or what if I don’t want to override
                   the style to use the same functionality with a
                   different look?</p>
                </div>




Saturday, June 11, 2011
js + css shouldn’t have
                         to share
                     </>   try to give id’s to javascript
                     </>   try to give classes to css
                     </>   use different classes for js
                     </>   class names should describe
                          </>   content type for css
                          </>   behavior/module for js




Saturday, June 11, 2011
reordering shouldn’t
                              hurt
                .aModule .leftThing .littleForm .fancyButton {
                  color: #a1eeee;
                }
                ...
                $(“.leftThing div > div a.fancyButton”).click(...);
                $(“#specialThing”).delegate(“a.fancyButton”, ... );




Saturday, June 11, 2011
reordering shouldn’t
                              hurt
                     </>   wire-up within scope or module
                     </>   no long selectors
                     </>   no delegating to sketchy containers
                     </>   markup wants to be free




Saturday, June 11, 2011
you write javascript;
                        you make html


Saturday, June 11, 2011
o/
                                thanks for being super!!




                          contact: @garannm or garann@gmail.com
Saturday, June 11, 2011

Weitere ähnliche Inhalte

Was ist angesagt?

Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureGarann Means
 
jQuery - Introdução
jQuery - IntroduçãojQuery - Introdução
jQuery - IntroduçãoGustavo Dutra
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETJames Johnson
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgetsvelveeta_512
 
Ciconf 2012 - Better than Ad-hoc
Ciconf 2012 - Better than Ad-hocCiconf 2012 - Better than Ad-hoc
Ciconf 2012 - Better than Ad-hocCalvin Froedge
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
Building Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScriptBuilding Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScriptdanwrong
 

Was ist angesagt? (18)

XML Schemas
XML SchemasXML Schemas
XML Schemas
 
J query training
J query trainingJ query training
J query training
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 
jQuery - Introdução
jQuery - IntroduçãojQuery - Introdução
jQuery - Introdução
 
jQuery Basic API
jQuery Basic APIjQuery Basic API
jQuery Basic API
 
jquery
jqueryjquery
jquery
 
Sequel @ madrid-rb
Sequel @  madrid-rbSequel @  madrid-rb
Sequel @ madrid-rb
 
JQuery
JQueryJQuery
JQuery
 
Basics of j query
Basics of j queryBasics of j query
Basics of j query
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
Jquery
JqueryJquery
Jquery
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NET
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
Ciconf 2012 - Better than Ad-hoc
Ciconf 2012 - Better than Ad-hocCiconf 2012 - Better than Ad-hoc
Ciconf 2012 - Better than Ad-hoc
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
jQuery
jQueryjQuery
jQuery
 
Building Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScriptBuilding Non-shit APIs with JavaScript
Building Non-shit APIs with JavaScript
 

Andere mochten auch

La neu dels pirineus power point!
La neu dels pirineus power point!La neu dels pirineus power point!
La neu dels pirineus power point!Hanaibrahim1
 
所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險
所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險
所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險ChengHeng Chuang
 
Kaya mawa South Africa
Kaya mawa   South AfricaKaya mawa   South Africa
Kaya mawa South AfricaJuan Gomez
 
Pinturas de Anna Kostenko
Pinturas de Anna KostenkoPinturas de Anna Kostenko
Pinturas de Anna KostenkoJuan Gomez
 
Turks & Caicos Islands ~ Luxury Homes
Turks & Caicos Islands ~ Luxury HomesTurks & Caicos Islands ~ Luxury Homes
Turks & Caicos Islands ~ Luxury HomesGrace Bay Realty
 

Andere mochten auch (6)

La neu dels pirineus power point!
La neu dels pirineus power point!La neu dels pirineus power point!
La neu dels pirineus power point!
 
所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險
所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險
所有的投資人都在找尋一個投資方法 -世紀富華變額年金保險
 
Es Dios
Es DiosEs Dios
Es Dios
 
Kaya mawa South Africa
Kaya mawa   South AfricaKaya mawa   South Africa
Kaya mawa South Africa
 
Pinturas de Anna Kostenko
Pinturas de Anna KostenkoPinturas de Anna Kostenko
Pinturas de Anna Kostenko
 
Turks & Caicos Islands ~ Luxury Homes
Turks & Caicos Islands ~ Luxury HomesTurks & Caicos Islands ~ Luxury Homes
Turks & Caicos Islands ~ Luxury Homes
 

Ähnlich wie Changeyrmarkup

Mike hostetler - jQuery knowledge append to you
Mike hostetler - jQuery knowledge append to youMike hostetler - jQuery knowledge append to you
Mike hostetler - jQuery knowledge append to youStarTech Conference
 
Web Scraping using Diazo!
Web Scraping using Diazo!Web Scraping using Diazo!
Web Scraping using Diazo!pythonchile
 
Rendering Views in JavaScript - "The New Web Architecture"
Rendering Views in JavaScript - "The New Web Architecture"Rendering Views in JavaScript - "The New Web Architecture"
Rendering Views in JavaScript - "The New Web Architecture"Jonathan Julian
 
The Contextual Experience of the Mobile Web
The Contextual Experience of the Mobile WebThe Contextual Experience of the Mobile Web
The Contextual Experience of the Mobile WebJeff Carouth
 
international PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPinternational PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPsmueller_sandsmedia
 
잘 알려지지 않은 Php 코드 활용하기
잘 알려지지 않은 Php 코드 활용하기잘 알려지지 않은 Php 코드 활용하기
잘 알려지지 않은 Php 코드 활용하기형우 안
 
Social design (Seattle 09-2011)
Social design (Seattle 09-2011)Social design (Seattle 09-2011)
Social design (Seattle 09-2011)Andrei Zyuzikov
 
Javascript - How to avoid the bad parts
Javascript - How to avoid the bad partsJavascript - How to avoid the bad parts
Javascript - How to avoid the bad partsMikko Ohtamaa
 
node.js for front-end developers
node.js for front-end developersnode.js for front-end developers
node.js for front-end developersGarann Means
 
The Fast, The Slow and the Lazy
The Fast, The Slow and the LazyThe Fast, The Slow and the Lazy
The Fast, The Slow and the LazyMaurício Linhares
 
Parser combinators
Parser combinatorsParser combinators
Parser combinatorslifecoder
 
Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)brockboland
 
edUI Conference: jQuery Mobile, Christine McClure
edUI Conference: jQuery Mobile, Christine McClureedUI Conference: jQuery Mobile, Christine McClure
edUI Conference: jQuery Mobile, Christine McClureChristine McClure
 
What's new in HTML5, CSS3 and JavaScript, James Pearce
What's new in HTML5, CSS3 and JavaScript, James PearceWhat's new in HTML5, CSS3 and JavaScript, James Pearce
What's new in HTML5, CSS3 and JavaScript, James PearceSencha
 
Aula 2,3 e 4 Publicidade Online
Aula 2,3 e 4 Publicidade OnlineAula 2,3 e 4 Publicidade Online
Aula 2,3 e 4 Publicidade OnlineKarina Rocha
 
Moving to Dojo 1.7 and the path to 2.0
Moving to Dojo 1.7 and the path to 2.0Moving to Dojo 1.7 and the path to 2.0
Moving to Dojo 1.7 and the path to 2.0James Thomas
 
Rubyistに 不足しているのは会計(そろばん)!
Rubyistに 不足しているのは会計(そろばん)!Rubyistに 不足しているのは会計(そろばん)!
Rubyistに 不足しているのは会計(そろばん)!Fukui Osamu
 

Ähnlich wie Changeyrmarkup (20)

Mike hostetler - jQuery knowledge append to you
Mike hostetler - jQuery knowledge append to youMike hostetler - jQuery knowledge append to you
Mike hostetler - jQuery knowledge append to you
 
Web Scraping using Diazo!
Web Scraping using Diazo!Web Scraping using Diazo!
Web Scraping using Diazo!
 
Rendering Views in JavaScript - "The New Web Architecture"
Rendering Views in JavaScript - "The New Web Architecture"Rendering Views in JavaScript - "The New Web Architecture"
Rendering Views in JavaScript - "The New Web Architecture"
 
The Contextual Experience of the Mobile Web
The Contextual Experience of the Mobile WebThe Contextual Experience of the Mobile Web
The Contextual Experience of the Mobile Web
 
CSS Power Tools
CSS Power ToolsCSS Power Tools
CSS Power Tools
 
international PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPinternational PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHP
 
잘 알려지지 않은 Php 코드 활용하기
잘 알려지지 않은 Php 코드 활용하기잘 알려지지 않은 Php 코드 활용하기
잘 알려지지 않은 Php 코드 활용하기
 
Social design (Seattle 09-2011)
Social design (Seattle 09-2011)Social design (Seattle 09-2011)
Social design (Seattle 09-2011)
 
Pocket Knife JS
Pocket Knife JSPocket Knife JS
Pocket Knife JS
 
Javascript - How to avoid the bad parts
Javascript - How to avoid the bad partsJavascript - How to avoid the bad parts
Javascript - How to avoid the bad parts
 
node.js for front-end developers
node.js for front-end developersnode.js for front-end developers
node.js for front-end developers
 
The Fast, The Slow and the Lazy
The Fast, The Slow and the LazyThe Fast, The Slow and the Lazy
The Fast, The Slow and the Lazy
 
Parser combinators
Parser combinatorsParser combinators
Parser combinators
 
Testable Javascript
Testable JavascriptTestable Javascript
Testable Javascript
 
Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)
 
edUI Conference: jQuery Mobile, Christine McClure
edUI Conference: jQuery Mobile, Christine McClureedUI Conference: jQuery Mobile, Christine McClure
edUI Conference: jQuery Mobile, Christine McClure
 
What's new in HTML5, CSS3 and JavaScript, James Pearce
What's new in HTML5, CSS3 and JavaScript, James PearceWhat's new in HTML5, CSS3 and JavaScript, James Pearce
What's new in HTML5, CSS3 and JavaScript, James Pearce
 
Aula 2,3 e 4 Publicidade Online
Aula 2,3 e 4 Publicidade OnlineAula 2,3 e 4 Publicidade Online
Aula 2,3 e 4 Publicidade Online
 
Moving to Dojo 1.7 and the path to 2.0
Moving to Dojo 1.7 and the path to 2.0Moving to Dojo 1.7 and the path to 2.0
Moving to Dojo 1.7 and the path to 2.0
 
Rubyistに 不足しているのは会計(そろばん)!
Rubyistに 不足しているのは会計(そろばん)!Rubyistに 不足しているのは会計(そろばん)!
Rubyistに 不足しているのは会計(そろばん)!
 

Kürzlich hochgeladen

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Changeyrmarkup

  • 1. <change your markup, change your life/> <!-- not another html5 talk --> Saturday, June 11, 2011
  • 2. o/ garann means / @garannm / garann.com Saturday, June 11, 2011
  • 3. famous progressive enhancement m&m http://www.alistapart.com/articles/understandingprogressiveenhancement/ Saturday, June 11, 2011
  • 4. removing the peanut == bad http://www.flickr.com/photos/npj/2681920153/ Saturday, June 11, 2011
  • 5. html </> is code </> is content </> is understood by all browsers </> let’s see your fancy-pants [popular programming language] do that! Saturday, June 11, 2011
  • 6. html the way nature intended Saturday, June 11, 2011
  • 7. use what you have </> inline-block </> numbered lists </> navigation between pages </> editable fields </> label-input relationships </> form submission Saturday, June 11, 2011
  • 8. this <img src=”gozer.jpg” alt=”photo of my dog” /> Saturday, June 11, 2011
  • 10. easier than this <div class=”photo”>photo of my dog</div> <div class=”ttip”></div> ... .photo { height: 400px; text-indent: ... } .ttip { display: none; position: ... } ... $(“div.photo”).mouseover(function() { var $t = $(this), alt = $t.text(), p = $t.position(), tt = $(“div.ttip”); tt.css({top:p.top,left:p.left}) .text(alt).show(); }) .mouseout(function() { $(“div.ttip”).hide(); }); Saturday, June 11, 2011
  • 11. this <select> <option>give you up</option> <option>let you down</option> <option>run around and desert you</option> <option>make you cry</option> <option>say goodbye</option> <option>tell a lie and hurt you</option> </select> Saturday, June 11, 2011
  • 13. easier than this <input type=”text” class=”dropdown” id=”my-dd”/> <ul class=”dropdown-list” data-dd=”my-dd”> <li>give you up</li> <li>let you down</li> <li>run around and desert you</li> <li>make you cry</li> <li>say goodbye</li> <li>tell a lie and hurt you</li> </ul> ... .dropdown-list { border: 1px solid #ccc; ...} ... $(“input.dropdown”).focus( ... ).blur( ... ); $(“ul.dropdown-list li”).click( ... ); Saturday, June 11, 2011
  • 14. don’t screw with the baseline </> too much resetting </> too many generic event handlers </> too many elements doing the wrong thing </> == too much work Saturday, June 11, 2011
  • 15. markup <div class=”user-content”> ... <ul> <li>A list</li> <li>With stuff in it</li> <li>That has bullets :O</li> </ul> ... </div> Saturday, June 11, 2011
  • 16. ..made more difficult ul, ol { list-style-type: none; } ... .user-content ul { list-style-type: disc; } .user-content ul ul { list-style-type: circle; } ... .user-content ol { list-style-type: decimal; } .user-content ol ol { list-style-type: lower-roman; } Saturday, June 11, 2011
  • 17. overwrite only when necessary </> bullets on lists </> margins on paragraphs </> onsubmit=”return false;” </> preventDefault() to use a link </> links that link somewhere </> http://necolas.github.com/normalize.css Saturday, June 11, 2011
  • 18. polyfills not plugins </> use the right solution </> build now for the future </> take advantage of html </> (even if it doesn’t exist yet) Saturday, June 11, 2011
  • 19. this <input type=”text” placeholder=”Type here” /> Saturday, June 11, 2011
  • 20. instead of this <input type=”text” class=”plchldr” /> <span class=”plchldr-txt”>Type here</span> ... $(“input.plchldr”).each(function() { var $t = $(this); $t.text($t.next().text()) .addClass(“plchldr-empty”); $t.focus(function() { $t.text(“”).removeClass(“plchldr-empty”) }); ... }); Saturday, June 11, 2011
  • 21. *except for this $(“.ie7 input[placeholder]”).each(function() { var $t = $(this); $t.text($t.attr(“placeholder”)) .addClass(“plchldr-empty”); $t.focus(function() { $t.text(“”).removeClass(“plchldr-empty”) }); ... }); Saturday, June 11, 2011
  • 22. design patterns for markup Saturday, June 11, 2011
  • 23. homes for htmls </> includes </> unrelated single-use pieces </> server-side templates </> compositions of elements </> client-side templates </> enhancements Saturday, June 11, 2011
  • 24. once it’s on the client </> common stuff in the page </> rarer stuff on demand </> smaller pieces as js vars </> don’t load anything more than once Saturday, June 11, 2011
  • 25. all OOP everything </> js isn’t object-oriented </> but we make it that way </> machine code: also not object-oriented </> we use abstractions </> html: not object-oriented </> or even a programming language </> MOAR ABSTRACTIONS Saturday, June 11, 2011
  • 26. singleton-ish </> create markup once you need it </> save private reference </> treat rendering as instantiation </> expose specific functionality Saturday, June 11, 2011
  • 27. singleton-ish app.Tooltip = { _tt: $(“#tooltip”), render: function(txt,pos) { if (!this._tt.length) { this._tt = $(‘<div id=”tooltip”>’) .appendTo(‘body’); } this._tt.text(txt); this._tt.css({left:pos.left,top:pos.top}).show(); }, hide: function() { this._tt.hide(); } }; Saturday, June 11, 2011
  • 28. factory-ish </> get markup once it’s needed </> same function for </> render once (e.g., init) </> add more Saturday, June 11, 2011
  • 29. factory-ish app.Address = { _html: null, addNew: function(container) { if (this._html) container.append(this._html); else this._load(container); }, _load: function(container) { var that = this; $.get(“addrTemplate.html”,function(tmpl) { that._html = $.tmpl(tmpl,null); that.addNew(container); }); } }; Saturday, June 11, 2011
  • 30. markup in your modules </> js != module </> js + css + markup == module </> data and functionality </> appearance </> actual interface Saturday, June 11, 2011
  • 31. markup in your modules app.myObj = function () { that = { _props: {}, init: function() { ... }, save: function() { ... }, _render: function() { // e.g. factory goes here ... } }; return that; }; Saturday, June 11, 2011
  • 32. markup needs its own controllers </> everything is not a module </> rendering </> multiple ways </> event handling </> state management Saturday, June 11, 2011
  • 33. markup needs its own controllers $(document).ready(function() { $(“form”).hide(); $(“#submitThingy”).live(“click”,function() { var f = $(“form”); $.post(f.attr(“action”),f.serialize(),function() { f.hide(); }); }); $(“#editButton”).live(“click”,function() { $(“form”).show(); }); }); Saturday, June 11, 2011
  • 34. markup needs its own controllers app.page = { aForm: $(“form”), init: function() { this.aForm.hide(); $(“#editButton”).live(“click”,that.edit); }, edit: function() { this.aForm.show(); $(“#submitThingy”).click(that.save); }, save: function() { $.post( ... ); } }; app.page.init(); Saturday, June 11, 2011
  • 35. this is your job Saturday, June 11, 2011
  • 36. go fast or go home <div class=”bottomRight”> <div class=”bottomLeft”> <div class=”topRight”> <div class=”topLeft”> <p>WTF, really??</p> </div> </div> </div> </div> ... <!-- plus the images, plus the css --> Saturday, June 11, 2011
  • 37. go fast or go home </> dowebsitesneedtolookexactlythesameinevery browser.com/ </> no </> markup weight </> non-markup weight </> speed vs. pixel perfection Saturday, June 11, 2011
  • 38. look better naked <strong>Please fill out this form</strong> <label>Name: </label> <input type=”text” id=”txtName” /> <label>Email: </label> <input type=”text” id=”txtEmail” /> <label>State: </label> <select id=”selState”> <option>Texas</option> <option>Not Texas</option> </select> Saturday, June 11, 2011
  • 39. look better naked <h1>Please fill out this form</h1> <form action=”/url” method=”POST”> <label>Name: <input type=”text” id=”txtName” /> </label><br/> <label>Email: <input type=”text” id=”txtEmail” /> </label><br/> <label>State: <select id=”selState”> <option>Texas</option> <option>Not Texas</option> </select> </label> </form> Saturday, June 11, 2011
  • 40. look better naked </> presentational markup is bad </> (it says so on the internet) </> presentational markup is good for presentation </> is it in the standards? </> manage the trade-offs Saturday, June 11, 2011
  • 41. js + css shouldn’t have to share <div class=”coolModule”> <img src=”aFace.jpg” alt=”J. User” /> <h3>J. User said:</h3> <p>What if I want coolModule to behave differently sometimes? Or what if I don’t want to override the style to use the same functionality with a different look?</p> </div> Saturday, June 11, 2011
  • 42. js + css shouldn’t have to share <div class=”comment expandable” id=”mostRecent”> <img src=”aFace.jpg” alt=”J. User” /> <h3>J. User said:</h3> <p>What if I want coolModule to behave differently sometimes? Or what if I don’t want to override the style to use the same functionality with a different look?</p> </div> Saturday, June 11, 2011
  • 43. js + css shouldn’t have to share </> try to give id’s to javascript </> try to give classes to css </> use different classes for js </> class names should describe </> content type for css </> behavior/module for js Saturday, June 11, 2011
  • 44. reordering shouldn’t hurt .aModule .leftThing .littleForm .fancyButton { color: #a1eeee; } ... $(“.leftThing div > div a.fancyButton”).click(...); $(“#specialThing”).delegate(“a.fancyButton”, ... ); Saturday, June 11, 2011
  • 45. reordering shouldn’t hurt </> wire-up within scope or module </> no long selectors </> no delegating to sketchy containers </> markup wants to be free Saturday, June 11, 2011
  • 46. you write javascript; you make html Saturday, June 11, 2011
  • 47. o/ thanks for being super!! contact: @garannm or garann@gmail.com Saturday, June 11, 2011