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

Unified Diff: pkg/template_binding/lib/src/element.dart

Issue 34453003: Rename mdv -> template_binding, remove experiemntal apis from dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « pkg/polymer_expressions/test/syntax_test.dart ('k') | pkg/template_binding/lib/src/input_bindings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/template_binding/lib/src/element.dart
diff --git a/pkg/mdv/lib/src/element.dart b/pkg/template_binding/lib/src/element.dart
similarity index 68%
rename from pkg/mdv/lib/src/element.dart
rename to pkg/template_binding/lib/src/element.dart
index d1f62da358c03c0bff0bc6118020b2d625c0522f..ccb1a286569cb18c743dbc00bbd2cd335d92f107 100644
--- a/pkg/mdv/lib/src/element.dart
+++ b/pkg/template_binding/lib/src/element.dart
@@ -2,21 +2,17 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of mdv;
+part of template_binding;
/** Extensions to the [Element] API. */
-class _ElementExtension extends _NodeExtension {
- _ElementExtension(Element node) : super(node);
+class _ElementExtension extends NodeBindExtension {
+ _ElementExtension(Element node) : super._(node);
// TODO(jmesserly): should path be optional, and default to empty path?
// It is used that way in at least one path in JS TemplateElement tests
// (see "BindImperative" test in original JS code).
NodeBinding createBinding(String name, model, String path) =>
- new _AttributeBinding(node, name, model, path);
-
- // Normally we issue this error in Element._ensureTemplate, but we
- // avoid calling that from the model getter, so issue the error here.
- get model => throw new UnsupportedError('$node is not a template.');
+ new _AttributeBinding(_node, name, model, path);
}
class _AttributeBinding extends NodeBinding {
@@ -28,7 +24,7 @@ class _AttributeBinding extends NodeBinding {
factory _AttributeBinding(Element node, name, model, path) {
bool conditional = name.endsWith('?');
if (conditional) {
- node.xtag.attributes.remove(name);
+ node.attributes.remove(name);
name = name.substring(0, name.length - 1);
}
return new _AttributeBinding._(node, name, model, path, conditional);
@@ -39,14 +35,14 @@ class _AttributeBinding extends NodeBinding {
void boundValueChanged(value) {
if (conditional) {
if (_toBoolean(value)) {
- node.xtag.attributes[property] = '';
+ node.attributes[property] = '';
} else {
- node.xtag.attributes.remove(property);
+ node.attributes.remove(property);
}
} else {
// TODO(jmesserly): escape value if needed to protect against XSS.
// See https://github.com/polymer-project/mdv/issues/58
- node.xtag.attributes[property] = sanitizeBoundValue(value);
+ node.attributes[property] = sanitizeBoundValue(value);
}
}
}
« no previous file with comments | « pkg/polymer_expressions/test/syntax_test.dart ('k') | pkg/template_binding/lib/src/input_bindings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698