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

Unified Diff: pkg/mdv/lib/src/text_area_element.dart

Issue 19593006: [mdv] Implement two-way binding to HTMLTextArea.value (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: pkg/mdv/lib/src/text_area_element.dart
diff --git a/pkg/mdv/lib/src/text_area_element.dart b/pkg/mdv/lib/src/text_area_element.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d8096914fc3d2bc781812d9187911cbe11f2b168
--- /dev/null
+++ b/pkg/mdv/lib/src/text_area_element.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// 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;
+
+/** Extensions to the [TextAreaElement] API. */
+class _TextAreaElementExtension extends _ElementExtension {
+ _ValueBinding _valueBinding;
+
+ _TextAreaElementExtension(TextAreaElement node) : super(node);
+
+ TextAreaElement get node => super.node;
+
+ void bind(String name, model, String path) {
+ if (name.toLowerCase() == 'value') {
+ unbind('value');
+ node.attributes.remove('value');
+ _valueBinding = new _ValueBinding(node, model, path);
+ }
+ }
+
+ void unbind(String name) {
+ if (name.toLowerCase() == 'value' && _valueBinding != null) {
+ _valueBinding.unbind();
+ _valueBinding = null;
+ }
+ }
+
+ void unbindAll() {
+ unbind('value');
+ super.unbindAll();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698