Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate

Issue 19663011: Custom Syntax's are now enabled via template.bindingDelegate = (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: restore @Experimental Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate
index eb3eb5152169a2b27ea425b28f42d581d534b1e0..6a1bd4a0d0297848910db77e7b0f1d7c3e10ad9d 100644
--- a/tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate
@@ -6,7 +6,6 @@
part of $LIBRARYNAME;
-
/**
* Model-Driven Views (MDV)'s native features enables a wide-range of use cases,
* but (by design) don't attempt to implement a wide array of specialized
@@ -15,32 +14,32 @@ part of $LIBRARYNAME;
* Enabling these features in MDV is a matter of implementing and registering an
* MDV Custom Syntax. A Custom Syntax is an object which contains one or more
* delegation functions which implement specialized behavior. This object is
- * registered with MDV via [TemplateElement.syntax]:
+ * registered with MDV via [Element.bindingDelegate]:
*
*
* HTML:
- * <template bind syntax="MySyntax">
+ * <template bind>
* {{ What!Ever('crazy')->thing^^^I+Want(data) }}
* </template>
*
* Dart:
- * class MySyntax extends CustomBindingSyntax {
+ * class MySyntax extends BindingDelegate {
* getBinding(model, path, name, node) {
* // The magic happens here!
* }
* }
- *
* ...
- *
- * TemplateElement.syntax['MySyntax'] = new MySyntax();
+ * query('template').bindingDelegate = new MySyntax();
+ * query('template').model = new MyModel();
*
* See <https://github.com/polymer-project/mdv/blob/master/docs/syntax.md> for
* more information about Custom Syntax.
*/
-// TODO(jmesserly): if this is just one method, a function type would make it
-// more Dart-friendly.
+// TODO(jmesserly): move this type to the MDV package? Two issues: we'd lose
+// type annotation on [Element.bindingDelegate], and "mdv" is normally imported
+// with a prefix.
@Experimental()
-abstract class CustomBindingSyntax {
+abstract class BindingDelegate {
/**
* This syntax method allows for a custom interpretation of the contents of
* mustaches (`{{` ... `}}`).
@@ -89,7 +88,6 @@ abstract class CustomBindingSyntax {
getInstanceModel(Element template, model) => model;
}
-
@Experimental()
$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
$!MEMBERS
@@ -291,11 +289,4 @@ option[template] {
}''';
document.head.append(style);
}
-
- /**
- * A mapping of names to Custom Syntax objects. See [CustomBindingSyntax] for
- * more information.
- */
- @Experimental()
- static Map<String, CustomBindingSyntax> syntax = {};
}
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698