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

Unified Diff: lib/src/js/polymer_bind_dart.html

Issue 1290643006: First cut at behaviors. This just implements the lifecycle methodsportion. We may get the rest for … (Closed) Base URL: git@github.com:dart-lang/polymer-dart.git@master
Patch Set: Created 5 years, 4 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: lib/src/js/polymer_bind_dart.html
diff --git a/lib/src/js/polymer_bind_dart.html b/lib/src/js/polymer_bind_dart.html
index 6793c0968fc29eff52d935432dc1d5801da391f2..d25caa991ae0781377e8a7d4ee206eada13e0406 100644
--- a/lib/src/js/polymer_bind_dart.html
+++ b/lib/src/js/polymer_bind_dart.html
@@ -1,3 +1,8 @@
+<!--
+Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
Siggi Cherem (dart-lang) 2015/08/13 18:52:41 +1 :)
jakemac 2015/08/13 19:14:29 Done.
+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.
+-->
<script>
if (Polymer.Bind) {
// Overwrite prepareInstance to a no-op for dart elements.
@@ -5,7 +10,7 @@ if (Polymer.Bind) {
Polymer.Bind.prepareInstance = function (inst) {
if (inst.__isPolymerDart__) return;
this._originalPrepareInstance(inst);
- }
+ };
// We always need to create property accessors for dart elements, because we
// always have `effects` (updating the dart class).
@@ -21,8 +26,20 @@ if (Polymer.Bind) {
// map of properties to effects
var fx$ = model._propertyEffects || {};
var p$ = model.properties;
- // for each property with effects
- for (var n in p$) {
+
+ // The union of the keys in fx$ and p$ (fx$ might contain properties from
+ // js behaviors, which don't appear in p$).
+ var allProperties = {};
+ for (var key in p$) {
+ allProperties[key] = true;
+ }
+ for (var key in fx$) {
+ allProperties[key] = true;
+ }
+
+ // for each dart property (with or without effects) and each js property
+ // with effects
+ for (var n in allProperties) {
// array of effects
var fx = fx$[n];
// effects have priority

Powered by Google App Engine
This is Rietveld 408576698