| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(jmesserly): more commentary here. | 5 // TODO(jmesserly): more commentary here. |
| 6 /** | 6 /** |
| 7 * This library provides access to Model-Driven-Views APIs on HTML elements. | 7 * This library provides access to Model-Driven-Views APIs on HTML elements. |
| 8 * More information can be found at: <https://github.com/toolkitchen/mdv>. | 8 * More information can be found at: <https://github.com/toolkitchen/mdv>. |
| 9 */ | 9 */ |
| 10 library mdv; | 10 library mdv; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * Binds all mustaches recursively starting from the [root] node. | 58 * Binds all mustaches recursively starting from the [root] node. |
| 59 * | 59 * |
| 60 * Note: this is not an official Model-Driven-Views API; it is intended to | 60 * Note: this is not an official Model-Driven-Views API; it is intended to |
| 61 * support binding the [ShadowRoot]'s content to a model. | 61 * support binding the [ShadowRoot]'s content to a model. |
| 62 */ | 62 */ |
| 63 // TODO(jmesserly): this is needed to avoid two <template> nodes when using | 63 // TODO(jmesserly): this is needed to avoid two <template> nodes when using |
| 64 // bindings in a custom element's template. See also: | 64 // bindings in a custom element's template. See also: |
| 65 // https://github.com/polymer-project/polymer/blob/master/src/bindMDV.js#L68 | 65 // https://github.com/polymer-project/polymer/blob/master/src/bindMDV.js#L68 |
| 66 // Called from: | 66 // Called from: |
| 67 // https://github.com/polymer-project/polymer/blob/master/src/register.js#L99 | 67 // https://github.com/polymer-project/polymer/blob/master/src/register.js#L99 |
| 68 void bindModel(Node root, model, [CustomBindingSyntax syntax]) { | 68 void bindModel(Node root, model, [BindingDelegate delegate]) { |
| 69 _addBindings(root, model, syntax); | 69 _addBindings(root, model, delegate); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 // TODO(jmesserly): investigate if expandos give us enough performance. | 73 // TODO(jmesserly): investigate if expandos give us enough performance. |
| 74 | 74 |
| 75 // The expando for storing our MDV wrappers. | 75 // The expando for storing our MDV wrappers. |
| 76 // | 76 // |
| 77 // In general, we need state associated with the nodes. Rather than having a | 77 // In general, we need state associated with the nodes. Rather than having a |
| 78 // bunch of individual expandos, we keep one per node. | 78 // bunch of individual expandos, we keep one per node. |
| 79 // | 79 // |
| (...skipping 23 matching lines...) Expand all Loading... |
| 103 } else if (node is Node) { | 103 } else if (node is Node) { |
| 104 wrapper = new _NodeExtension(node); | 104 wrapper = new _NodeExtension(node); |
| 105 } else { | 105 } else { |
| 106 // TODO(jmesserly): this happens for things like CompoundBinding. | 106 // TODO(jmesserly): this happens for things like CompoundBinding. |
| 107 wrapper = node; | 107 wrapper = node; |
| 108 } | 108 } |
| 109 | 109 |
| 110 _mdvExpando[node] = wrapper; | 110 _mdvExpando[node] = wrapper; |
| 111 return wrapper; | 111 return wrapper; |
| 112 } | 112 } |
| OLD | NEW |