Slide 1

Slide 1 text

var src='http://facebook.com/jamesgpearce';

Slide 2

Slide 2 text

Sushi! window.addEventListener('load', function () { // and now I get on with my craft }, false);

Slide 3

Slide 3 text

// I trust my styles // I trust my libraries // I trust my runtime // I trust my code

Slide 4

Slide 4 text

Slide 5

Slide 5 text

Sushi!

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

console.log(document.body.outerHTML);

Slide 9

Slide 9 text

// WYSITMINWYGITD

Slide 10

Slide 10 text

var importantThing = document.body.appendChild( document.createElement('div') );

Slide 11

Slide 11 text

// now we have to go back and get it var thing = document.getElementById('thing'); // oh, or maybe there were several of them var things = document.getElementsByClassName('things'); // oh, no! NodeList is not an array! for (var i=0, l=things.length; i < l; i++) { // do something to things.item(i); } // finally try to be awesome

Slide 12

Slide 12 text

$('#warning').html('

You might be doing it wrong

');

Slide 13

Slide 13 text

var addElement = function(name, attrs, innerText, parent) { var element = document.createElement(name); for (a in attrs) { element.setAttribute(a, attrs[a]); } if (innerText !== undefined) { element.innerText = innerText; } if (parent === undefined) { parent = document.body; } return parent.appendChild(element); };

Slide 14

Slide 14 text

var video = addElement('video', {autoplay: false}), play = addElement('button', null, 'Play'); play.addEventListener('click', function () { video.play(); });

Slide 15

Slide 15 text

// no post-load, post-render, DOM traversal // well-scoped variable references to DOM elements // easy iterative or recursive element creation // no markup verbosity on the wire // no need to overload attribute semantics // reduce class or ID collisions

Slide 16

Slide 16 text

// avoid the impedance mismatch between markup and script

Slide 17

Slide 17 text

Sushi! window.addEventListener('load', function () { // magic }, false);

Slide 18

Slide 18 text

Sushi! window.addEventListener('load', function () { // magic }, false);

Slide 19

Slide 19 text

Sushi! window.addEventListener('load', function () { // magic }, false);

Slide 20

Slide 20 text

document.head.appendChild( document.createElement('title') ).innerText = 'Sushi';

Slide 21

Slide 21 text

var style = document.head.appendChild( document.createElement('link') ); style.href = 'style.css'; style.rel = 'stylesheet'; // kicks off the request

Slide 22

Slide 22 text

var library = document.head.appendChild( document.createElement('script') ); library.addEventListener('load', function () { // now we're in business }; library.src = 'library.js'; // kicks off the request

Slide 23

Slide 23 text

Slide 24

Slide 24 text

switch (reaction) { case SEEMS_REASONABLE: // sure, why not? break; default: throw ('HOW ABOUT NO?'); }

Slide 25

Slide 25 text

try { // provoke } catch (e) { }

Slide 26

Slide 26 text

// there is no one way to do web

Slide 27

Slide 27 text

declarative imperative thin client thick client web sites web apps large screen small screen sedentary mobile read-only read-write stateless stateful anonymous social

Slide 28

Slide 28 text

Slide 29

Slide 29 text

// When did the web start to dream about being an app platform?

Slide 30

Slide 30 text

Slide 31

Slide 31 text

Telephone:

Your number is $(tel)

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

var superficialDebate() { if (arguments) { return NATIVE; } else { return WEB; } }

Slide 34

Slide 34 text

// "the web will always win"

Slide 35

Slide 35 text

Television won’t be able to hold on to any market it captures after the first six months. People will soon get tired of staring at a plywood box every night - Darryl Zanuck, 20th Century Fox, 1946

Slide 36

Slide 36 text

// what can the web learn? // how can it stay relevant & competitive? // how can it keep the lights on?

Slide 37

Slide 37 text

The web is wearing out - Matt DeBergalis, Meteor, 2012

Slide 38

Slide 38 text

// server - cpu - - - - - - - - - - - client // mainframes // server - - - - - - - - - - - cpu - client // workstations // server - cpu - - - - - - - - - - - client // the web // ? cpu - client // mobile

Slide 39

Slide 39 text

Slide 40

Slide 40 text

var xhr = new ActiveXObject('Microsoft.XMLHTTP');

Slide 41

Slide 41 text

switch (tag.name) { case 'input' switch (tag.getAttribute('type')) { case 'date': // something interesting case 'color': // something interesting ... } ... }

Slide 42

Slide 42 text

switch (tag.name) { case 'input' switch (tag.getAttribute('type')) { case 'date': // something interesting case 'color': // something interesting ... } ... default: // may as well be a
or a }

Slide 43

Slide 43 text

:host { display: contents; } div.carousel { overflow-x: hidden; ... }
// show all the pictures

Slide 44

Slide 44 text

document.createElement('x-carousel');

Slide 45

Slide 45 text

var carousel = new Carousel();

Slide 46

Slide 46 text

Slide 47

Slide 47 text

When I'm introspective about the last few years, I think the biggest mistake that we made as a company was betting too much on HTML5 as opposed to native. Because it just wasn't there. - Mark Zuckerberg, 2012

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

It's not that HTML5 is bad. I'm actually, in the long-term, really excited about it. One of the things that's interesting is we actually have more people on a daily basis using Facebook on the mobile Web than we have using our iOS or Android apps combined.

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

// the web as first class app platform

Slide 52

Slide 52 text

// but it is a privilege it can earn

Slide 53

Slide 53 text