Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MASTERING KNOCKOUTJS

You're reading from   MASTERING KNOCKOUTJS Use and extend Knockout to deliver feature-rich, modern web applications

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781783981007
Length 270 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Timothy Moran Timothy Moran
Author Profile Icon Timothy Moran
Timothy Moran
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Knockout Essentials 2. Extending Knockout with Custom Binding Handlers FREE CHAPTER 3. Extending Knockout with Preprocessors and Providers 4. Application Development with Components and Modules 5. Durandal – the Knockout Framework 6. Advanced Durandal 7. Best Practices 8. Plugins and Other Knockout Libraries 9. Under the Hood Index

Applying bindings


The binding application process takes place primarily in the bindingAttributeSyntax module, which defines the ko.bindingContext class as well as the ko.applyBindings method. The high-level overview looks like this:

  1. The ko.applyBindings method is called with the viewmodel.

  2. A binding context is constructed using the viewmodel.

  3. The binding provider is retrieved from ko.bindingProvider.instance.

  4. Knockout works with the DOM tree:

    • It is passed through the binding provider's node preprocessor (except the root node)

    • The binding handlers for the node are constructed using the binding provider

    • The binding handlers are sorted by ensuring that any bindings in their after property are loaded first

    • The binding handlers are iterated through, calling each handler's init and update function.

The first three steps are pretty straightforward; even the walking algorithm is just a simple recursion that applies bindings to a node and then iterates over its children to preprocess and bind them. The real...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime