| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 * | 54 * |
| 55 * Note: this is not an official Model-Driven-Views API; it is intended to | 55 * Note: this is not an official Model-Driven-Views API; it is intended to |
| 56 * support binding the [ShadowRoot]'s content to a model. | 56 * support binding the [ShadowRoot]'s content to a model. |
| 57 */ | 57 */ |
| 58 // TODO(jmesserly): this is needed to avoid two <template> nodes when using | 58 // TODO(jmesserly): this is needed to avoid two <template> nodes when using |
| 59 // bindings in a custom element's template. See also: | 59 // bindings in a custom element's template. See also: |
| 60 // https://github.com/polymer-project/polymer/blob/master/src/bindMDV.js#L68 | 60 // https://github.com/polymer-project/polymer/blob/master/src/bindMDV.js#L68 |
| 61 // Called from: | 61 // Called from: |
| 62 // https://github.com/polymer-project/polymer/blob/master/src/register.js#L99 | 62 // https://github.com/polymer-project/polymer/blob/master/src/register.js#L99 |
| 63 void bindModel(Node root, model, [CustomBindingSyntax syntax]) { | 63 void bindModel(Node root, model, [CustomBindingSyntax syntax]) { |
| 64 _Bindings._addBindings(root, model, syntax); | 64 _addBindings(root, model, syntax); |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 // TODO(jmesserly): investigate if expandos give us enough performance. | 68 // TODO(jmesserly): investigate if expandos give us enough performance. |
| 69 | 69 |
| 70 // The expando for storing our MDV wrappers. | 70 // The expando for storing our MDV wrappers. |
| 71 // | 71 // |
| 72 // In general, we need state associated with the nodes. Rather than having a | 72 // In general, we need state associated with the nodes. Rather than having a |
| 73 // bunch of individual expandos, we keep one per node. | 73 // bunch of individual expandos, we keep one per node. |
| 74 // | 74 // |
| (...skipping 19 matching lines...) Expand all Loading... |
| 94 } else if (node is Node) { | 94 } else if (node is Node) { |
| 95 wrapper = new _NodeExtension(node); | 95 wrapper = new _NodeExtension(node); |
| 96 } else { | 96 } else { |
| 97 // TODO(jmesserly): this happens for things like CompoundBinding. | 97 // TODO(jmesserly): this happens for things like CompoundBinding. |
| 98 wrapper = node; | 98 wrapper = node; |
| 99 } | 99 } |
| 100 | 100 |
| 101 _mdvExpando[node] = wrapper; | 101 _mdvExpando[node] = wrapper; |
| 102 return wrapper; | 102 return wrapper; |
| 103 } | 103 } |
| OLD | NEW |