Slide 1

Slide 1 text

@fat May 2012 Bootstrap.js?

Slide 2

Slide 2 text

I’m @fat

Slide 3

Slide 3 text

I work at twitter

Slide 4

Slide 4 text

I write libraries

Slide 5

Slide 5 text

Bootstrap Hogan.js Ender

Slide 6

Slide 6 text

This is usually where I start discussing literature

Slide 7

Slide 7 text

But instead of reading last weekend I decided to go on a roadtrip

Slide 8

Slide 8 text

I drove south with O’Reilly author @maccman

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

We had the best intentions

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

So...we were in Disneyland

Slide 13

Slide 13 text

And I was asked to talk about bootstrap

Slide 14

Slide 14 text

One theme really stood out at Disneyland

Slide 15

Slide 15 text

The importance of perception

Slide 16

Slide 16 text

Forced Perspective, Sound Engineering, etc.

Slide 17

Slide 17 text

What is the perception of Bootstrap?

Slide 18

Slide 18 text

And is this what it should be?

Slide 19

Slide 19 text

Bootstrap is a glorified stylesheet and html template

Slide 20

Slide 20 text

A little history

Slide 21

Slide 21 text

9 months ago our first public release

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

A library for kickstarting CSS

Slide 24

Slide 24 text

People loved it

Slide 25

Slide 25 text

Really only had a single css asset

Slide 26

Slide 26 text

I loved it

Slide 27

Slide 27 text

29 days later 1.3 is released

Slide 28

Slide 28 text

We add 7 js plugins

Slide 29

Slide 29 text

I was afraid this was a huge mistake

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Bootstrap still fundamentally a CSS library

Slide 32

Slide 32 text

JS was provided as the “minimum” required to get you started

Slide 33

Slide 33 text

But a pretty classical approach to writing plugins

Slide 34

Slide 34 text

this bothered me

Slide 35

Slide 35 text

3 months later we began work for our 2.0 release

Slide 36

Slide 36 text

Hooray a chance to change all the things! \o/

Slide 37

Slide 37 text

Complete rewrite of all the plugins plus add some new ones

Slide 38

Slide 38 text

total of 12 plugins alert button carousel collapse dropdown modal popover scrollspy tab tooltip transitions typeahead

Slide 39

Slide 39 text

remove features and options aggressively

Slide 40

Slide 40 text

Promote the data- api as a first class api

Slide 41

Slide 41 text

This is a fundamentally different approach to existing ui-toolkits

Slide 42

Slide 42 text

JS api going forward to be a second class citizen

Slide 43

Slide 43 text

why? better separation of form and function

Slide 44

Slide 44 text

why? harder for beginners to get in trouble

Slide 45

Slide 45 text

why? less memory intensive

Slide 46

Slide 46 text

why? great for server-side rendering

Slide 47

Slide 47 text

Data api looks like this: data-{{verb}}={{plugin}} - defines main interaction data-target || href^=# - defines target (optional) data-{{option}} - defines class instance options

Slide 48

Slide 48 text

Slide 49

Slide 49 text

release 2.0

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

Bootstrap still considered a glorified stylesheet and html template

Slide 52

Slide 52 text

But it’s not that you can’t do really powerful stuff with JS

Slide 53

Slide 53 text

Like with our LESS, Bootstrap’s JS was built to be extended

Slide 54

Slide 54 text

Turn the data api off - $('body').off('.data-api')

Slide 55

Slide 55 text

Set your own defaults - $.fn.modal.defaults

Slide 56

Slide 56 text

Subclass modules - $.fn.popover.Constructor

Slide 57

Slide 57 text

Retrieve raw plugin instances - $('[rel=popover]').data('popover')

Slide 58

Slide 58 text

Listen to custom events - $('#myModal').on('show', fn)

Slide 59

Slide 59 text

Prevent default execution - e.preventDefault()

Slide 60

Slide 60 text

This is all there

Slide 61

Slide 61 text

but your first thought should not be to use it

Slide 62

Slide 62 text

instead get as far as you can without it

Slide 63

Slide 63 text

and that’s really why the perception is so important

Slide 64

Slide 64 text

In 2.0.2 we actually did change the readme

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

Perhaps it’s a mistake to mention HTML, CSS, JavaScript at all

Slide 67

Slide 67 text

End goal popular user interface components and interactions

Slide 68

Slide 68 text

how do we get there?

Slide 69

Slide 69 text

A new spec Web Components

Slide 70

Slide 70 text

4 things templates, decorators, custom elements, shadow dom

Slide 71

Slide 71 text

Ability to define isolated and encapsulated widgets

Slide 72

Slide 72 text

Similar to IE Behaviors?

Slide 73

Slide 73 text

HTML not .htc

Slide 74

Slide 74 text

How does this work?

Slide 75

Slide 75 text

Custom Elements allow you to define new components

Slide 76

Slide 76 text

Slide 77

Slide 77 text

Slide 78

Slide 78 text

Inside the element tag lots of magical magic

Slide 79

Slide 79 text

Script elements inside executed in different context

Slide 80

Slide 80 text

cool things like generatedConstructor lifecycle listen

Slide 81

Slide 81 text

as document fragments and

Slide 82

Slide 82 text

Scoped styles

Slide 83

Slide 83 text

So all this has to be inside an element tag?

Slide 84

Slide 84 text

yes but that’s actually great

Slide 85

Slide 85 text

Slide 86

Slide 86 text

Bootstrap back to a single asset some day?

Slide 87

Slide 87 text

Popular user interface components and interactions

Slide 88

Slide 88 text

Bootstrap back to a single asset some day?

Slide 89

Slide 89 text

follow @fakeangus