This document lays out the design for Model-driven Views (MDV): A proposal for extending HTML and the DOM APIs to support a sensible separation between the UI (DOM) of a document or application and its underlying data (model). Updates to the model are reflected in the DOM and user input into the DOM is immediately assigned to the model.
<div id="example">
Goals:
<ul>
<template iterate>
<li>{{ goal }}</li>
</template>
</ul>
</div>
...
<script>
document.getElementById('example').model = [
{goal: 'Fast'},
{goal: 'Safe'},
{goal: 'Simple'},
{goal: 'Stable'}
];
</script>
Note: Extra whitespace/formatting is added in the output part of code samples for clarity's sake. Template instances in the design and prototype do not add extra whitespace.
<div id="example">
Goals:
<ul>
<template iterate></template>
<li>Fast</li>
<!--template-instance-->
<li>Safe</li>
<!--template-instance-->
<li>Simple</li>
<!--template-instance-->
<li>Stable</li>
<!--template-instance-->
</ul>
</div>
The intended audience of this document is browser implementors who wish to understand the work done so far by Google. This document (along with the prototype that implements most of the design described) is intended as a starting point for a discussion about how to best solve the broad motivations of this effort.
The design is not complete. Following each section is a list of open issues. Separately, aspects of the design which are currently sub-optimal are called out as needing more attention.
The overall design for MDV has five main components