SlideShare a Scribd company logo
Conquering the DOM with live binding
MilwaukeeJS
Stan Carrico, JS Engineer
What is live binding?
definition
a tool that produces a direct HTML representation of the current state of
an underlying data structure
also referred to as “data binding”
why you want to use it
more solid separation of view manipulation logic from data and control
logic
reduce complexity of implementation
reduce or eliminate boilerplate DOM manipulation code
offload DOM creation to an optimized library **
** not always faster than manual updates, but reduced complexity outweighs the potential speed decreases in most cases.
simple example
http://codepen.io/shcarrico/pen/gvjpi
common characteristics of live
binding solutions
computed properties
template
view model
DOM/custom event handler patterns to update data structures
one way (data —> UI) and two-way (ui <—> data) binding
how does live binding work?
for most live binding solutions…
template is "compiled" into a set of function hooks
template engine subscribes to observable object
events trigger calls to function hooks, which updates a specific part of
output.
custom bindings allowed through use of helper functions in templates
Build better
apps, faster!
can.view
wrapper for templating solutions that hooks up bindings to "compiled"
template output
accomplishes template acquisition if necessary
can be used with or without other parts of the framework
simple example (again)
http://codepen.io/shcarrico/pen/gvjpi
can.compute
observable data object, emits events when it changes
the basis of can.Map and can.List
simple example (one more time)
http://codepen.io/shcarrico/pen/gvjpi
can.Control
A lightweight wrapper around a DOM element that provides a pattern for memory safe event
handlers and element content lifecycle.
element
the root element for your control
all event handlers are auto delegated to the control’s element
options
scoped properties provided during instantiation
can emit events, which will be routed to internal handlers
simple example refactored
http://codepen.io/shcarrico/pen/EFKim
can.Component
A web component polyfill providing a pattern and utility methods to
implement live bound page controls represented by a custom HTML tag.
wait, what’s a web component?
the web components spec
http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/
shadow dom
can.Component tag
the custom tag that represents the external interface to the component
can.Component scope
an instance of can.Map, or the component's "view model"
can.Component template
a string template in can.Mustache or can.Stache syntax. Used to create
the markup for this component.
can.Component helpers
helper functions that can perform logic to produce string output for your
template.
can.Component events
a list of event handlers. these are delegated to the custom tag for the
component.
all those parts again..
can.Component
tag
scope
template
helpers
events
a different large scale pattern
define but do not instantiate
controls or more traditional constructs require a ‘bootstrap’ script
components (and web components) instantiate themselves when their
custom tag is encountered
to “init” your component, you just put it in the template rendering
pipeline
in future, you will be able to include custom tags directly in your HTML
can.Component two way binding
http://codepen.io/shcarrico/pen/zHmuk
can.Component nested tags
http://codepen.io/shcarrico/pen/gJbCo
Thank you for coming!
http://bithub.com/
https://github.com/shcarrico
http://codepen.io/shcarrico/

More Related Content

PPTX
Client Object Model - SharePoint Extreme 2012
PPTX
Angular JS, A dive to concepts
PPTX
angularJS Practicle Explanation
PPTX
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
PPT
MVC ppt presentation
PPTX
Front end development with Angular JS
PPTX
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
PPTX
Angular js 1.3 basic tutorial
Client Object Model - SharePoint Extreme 2012
Angular JS, A dive to concepts
angularJS Practicle Explanation
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
MVC ppt presentation
Front end development with Angular JS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Angular js 1.3 basic tutorial

What's hot (20)

PPTX
Visual Studio 2010 Ultimate Architecture Experience : Toronto Code Camp 2010 ...
PPTX
Angular js
PPTX
Step by Step - AngularJS
PPTX
Angular js
PPTX
AngularJS Beginners Workshop
PDF
Angular JS tutorial
PPT
MVC Pattern. Flex implementation of MVC
PPTX
Std 12 Computer Chapter 2 Cascading Style Sheet and Javascript (Part-2)
PPTX
AngularJS 2.0
PPTX
Angular js
PPTX
AngularJS intro
PPTX
Understanding angular js
PPTX
Angular js 1.0-fundamentals
PPTX
Angular js for beginners
PPTX
AngularJs Workshop SDP December 28th 2014
PPTX
Building dynamic applications with the share point client object model
PPTX
Angular js architecture (v1.4.8)
PDF
Building a custom Oracle ADF Component
PPTX
Introduction to react js
PDF
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Visual Studio 2010 Ultimate Architecture Experience : Toronto Code Camp 2010 ...
Angular js
Step by Step - AngularJS
Angular js
AngularJS Beginners Workshop
Angular JS tutorial
MVC Pattern. Flex implementation of MVC
Std 12 Computer Chapter 2 Cascading Style Sheet and Javascript (Part-2)
AngularJS 2.0
Angular js
AngularJS intro
Understanding angular js
Angular js 1.0-fundamentals
Angular js for beginners
AngularJs Workshop SDP December 28th 2014
Building dynamic applications with the share point client object model
Angular js architecture (v1.4.8)
Building a custom Oracle ADF Component
Introduction to react js
Karlsruher Entwicklertag 2013 - Webanwendungen mit AngularJS
Ad

Similar to Milwaukee JS - Live binding with CanJS (20)

PPTX
Rawnet Lightning Talk - Web Components
PDF
Html 5 in a big nutshell
PDF
Developing maintainable Cordova applications
PPT
DDD Framework for Java: JdonFramework
PPTX
Use Eclipse technologies to build a modern embedded IDE
PPT
Ibm
PDF
Angular - Chapter 4 - Data and Event Handling
PPT
Monorail presentation at WebDevelopersCommunity, Feb 1, 2009
PPT
Silverlight 2 for Developers - TechEd New Zealand 2008
PDF
Thug: a new low-interaction honeyclient
PPTX
Web components
PPT
Struts Ppt 1
PDF
Rapid Prototyping with TurboGears2
PPT
What's New for AJAX Developers in IE8 Beta1?
PPTX
Google Polymer Introduction
PPT
WPF Fundamentals
PDF
PyData Berlin 2023 - Mythical ML Pipeline.pdf
PDF
Architecture Specification - Visual Modeling Tool
PPT
Adobe Flex4
PPTX
.net Framework
Rawnet Lightning Talk - Web Components
Html 5 in a big nutshell
Developing maintainable Cordova applications
DDD Framework for Java: JdonFramework
Use Eclipse technologies to build a modern embedded IDE
Ibm
Angular - Chapter 4 - Data and Event Handling
Monorail presentation at WebDevelopersCommunity, Feb 1, 2009
Silverlight 2 for Developers - TechEd New Zealand 2008
Thug: a new low-interaction honeyclient
Web components
Struts Ppt 1
Rapid Prototyping with TurboGears2
What's New for AJAX Developers in IE8 Beta1?
Google Polymer Introduction
WPF Fundamentals
PyData Berlin 2023 - Mythical ML Pipeline.pdf
Architecture Specification - Visual Modeling Tool
Adobe Flex4
.net Framework
Ad

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
sap open course for s4hana steps from ECC to s4
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
Programs and apps: productivity, graphics, security and other tools
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Reach Out and Touch Someone: Haptics and Empathic Computing

Milwaukee JS - Live binding with CanJS

Editor's Notes

  • #25: data can be passed in via element attributes for scoping reasons, we require a root template to be injected into the actual DOM we prefer a small manual step to a large automated scanner.. w/o full browser support, scanning would be required.