19
ActiveDOM jQuery(‘a.nd > html :tricks’).for(‘web application’).data(); by Felix Geisendörfer

ActiveDOM

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: ActiveDOM

ActiveDOMjQuery(‘a.nd > html :tricks’).for(‘web application’).data();

by Felix Geisendörfer

Page 2: ActiveDOM

About me

• Felix Geisendörfer, 20 years old, Germany

• Blogger / Programmer / Entrepreneur

• Used jQuery in all battle fields

• School projects, small business sites, 300++ DB table monster project

Page 3: ActiveDOM

Key ideas

• Make the DOM represent you data (semantics)

• Abstract the DOM interaction away from

• Known your audience - no silver bullets.

• JSON is your friend in times of trouble.

Page 4: ActiveDOM

Data on your server

Database

posts

users

tags

Tables Rows

id

user_id

title

text

created

modified

Columns

Page 5: ActiveDOM

Data in your client

id

user_id

title

text

created

modified

Table ‘posts’ DOM / Html representation

Page 6: ActiveDOM

Manipulating data in the DOM

Lets say we want to change the ‘text’ field ...

Page 7: ActiveDOM

This is why we love, jQuery!

Page 8: ActiveDOM

Lets make it more difficult ...

Lets try to change the ‘user_id’ ...

Page 9: ActiveDOM

And a last one

Changing the ‘created’ column

Page 10: ActiveDOM

What about reading the data?

Page 11: ActiveDOM

What is the Pattern?

Page 12: ActiveDOM

Mapping columns to get /set functions

id

user_id

title

text

created

modified

Columns DOM transformation / access functions

get

set

get

set

getset

Page 13: ActiveDOM

A map for DOM-land

Page 14: ActiveDOM

How to use the map?

?

Page 15: ActiveDOM

Use it directly?

beats

Page 16: ActiveDOM

Problems

• Only operates on one ‘post’ object

• Clumsy syntax

• No Chaining

Page 17: ActiveDOM

How far can you go?

with some abstraction

with custom css selectors

Page 18: ActiveDOM

How to get there?

• Plugin generator

• Routing plugin function calls to sub-functions

• Re-using the ‘fields’ map logic for plugins

Page 19: ActiveDOM

Questions?

Thanks goes to John & the jQuery team!

Talk will be online at: thinkingphp.org