Book Image

Knockout.JS Essentials

Book Image

Knockout.JS Essentials

Overview of this book

Table of Contents (16 chapters)
KnockoutJS Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Unobtrusive events with jQuery


In the last few years, it has been a good practice to remove all JavaScript from HTML templates. If we remove all JavaScript code from HTML templates and encapsulate it in JavaScript files, we are doing imperative programming. On the other hand, if we write JavaScript code or use components and bindings in HTML files, we are using declarative programming. Many programmers don't like to use declarative programming. They think this makes it more difficult for designers to work with templates. We should note that designers are not programmers and they may not understand JavaScript syntax. Besides, declarative programming splits related code into different files and may make it difficult to understand how the entire application works. Also, they point out that the two-way binding makes models inconsistent because they are updated on the fly, without any validation. On the other side, we have people who think that declarative programming makes code more maintainable...