diff --git a/src/lib/bind/accessors.html b/src/lib/bind/accessors.html
index 265ca662ea..b07987cd8c 100644
--- a/src/lib/bind/accessors.html
+++ b/src/lib/bind/accessors.html
@@ -11,6 +11,8 @@
Polymer.Bind = {
+ _dataEventCache: {},
+
// for prototypes (usually)
prepareModel: function(model) {
@@ -22,7 +24,17 @@
_modelApi: {
_notifyChange: function(event, value) {
- Polymer.Base.fire(event, {value: value}, {bubbles: false, node: this});
+ var cache = Polymer.Bind._dataEventCache;
+ var e = cache[event];
+ if (e) {
+ cache[event] = null;
+ } else {
+ e = new CustomEvent(event,
+ {bubbles: false, cancelable: false, detail: {}});
+ }
+ e.detail.value = value;
+ this.dispatchEvent(e);
+ cache[event] = e;
},
// TODO(sjmiles): removing _notifyListener from here breaks accessors.html
@@ -182,7 +194,7 @@
_addAnnotatedListener: function(model, index, property, path, event) {
var fn = this._notedListenerFactory(property, path,
- this._isStructured(path), this._isEventBogus);
+ this._isStructured(path));
var eventName = event ||
(Polymer.CaseMap.camelToDashCase(property) + '-changed');
model._bindListeners.push({
@@ -202,27 +214,23 @@
return e.path && e.path[0] !== target;
},
- _notedListenerFactory: function(property, path, isStructured, bogusTest) {
- return function(e, target) {
- if (!bogusTest(e, target)) {
- if (e.detail && e.detail.path) {
- this._notifyPath(this._fixPath(path, property, e.detail.path),
- e.detail.value);
+ _notedListenerFactory: function(property, path, isStructured) {
+ return function(target, value, targetPath) {
+ if (targetPath) {
+ this._notifyPath(this._fixPath(path, property, targetPath), value);
+ } else {
+ value = value !== undefined ? value : target[property];
+ if (!isStructured) {
+ this[path] = value;
} else {
- var value = target[property];
- if (!isStructured) {
- this[path] = target[property];
- } else {
- // TODO(kschaaf): dirty check avoids null references when the object has gone away
- if (this.__data__[path] != value) {
- this.set(path, value);
- }
+ // TODO(kschaaf): dirty check avoids null references when the object has gone away
+ if (this.__data__[path] != value) {
+ this.set(path, value);
}
}
}
};
},
-
// for instances
prepareInstance: function(inst) {
diff --git a/src/standard/configure.html b/src/standard/configure.html
index 8d493fa60e..9a547958e5 100644
--- a/src/standard/configure.html
+++ b/src/standard/configure.html
@@ -187,10 +187,14 @@
// effects and side effects must not be processed before ready time,
// handling is queue/defered until then.
_notifyListener: function(fn, e) {
- if (!this._clientsReadied) {
- this._queueHandler([fn, e, e.target]);
- } else {
- return fn.call(this, e, e.target);
+ if (!Polymer.Bind._isEventBogus(e, e.target)) {
+ var value = e.detail.value;
+ var path = e.detail.path;
+ if (!this._clientsReadied) {
+ this._queueHandler([fn, e.target, value, path]);
+ } else {
+ return fn.call(this, e.target, value, path);
+ }
}
},
@@ -201,7 +205,7 @@
_flushHandlers: function() {
var h$ = this._handlers;
for (var i=0, l=h$.length, h; (i