Skip to content

Commit e6c447d

Browse files
author
Dan Lasky
committed
fix event override breaking binding for collection
1 parent e2e18a9 commit e6c447d

2 files changed

Lines changed: 23 additions & 19 deletions

File tree

src/shared/js/ajax.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,18 @@
247247
return output;
248248
},
249249

250-
fire: function(type, detail) {
251-
if (this._eventPrefix) {
250+
fire: function(type, detail, options) {
251+
if (this._eventPrefix && DataUtils.getPathValue('prefix', options)) {
252252
type = this._eventPrefix + type;
253253
}
254-
var e = new CustomEvent(type, {detail:detail});
255-
this.dispatchEvent(e);
256-
},
254+
if (this.is) {
255+
Polymer.Base.fire.call(this, type, detail, options);
256+
} else {
257+
//JS Object
258+
var e = new CustomEvent(type, {detail:detail});
259+
this.dispatchEvent(e);
260+
}
261+
},
257262

258263
get status() {
259264
return this.current && this.current.xhr.status;
@@ -281,9 +286,6 @@
281286
},
282287
ready: function() {
283288
Ajax.apply(this);
284-
},
285-
fire: function(type, details) {
286-
Polymer.Base.fire.call(this, this._eventPrefix + type, details);
287289
}
288290
});
289291

src/shared/js/sync.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153

154154
_handleResult: function(result) {
155155

156-
this.fire("ready", result);
156+
this.fire("ready", result, {prefix:true});
157157

158158
result = this._plugin.processResponse(result);
159159

@@ -164,12 +164,12 @@
164164
} else {
165165
this.data = result.marshalled;
166166
}
167-
this.fire("saved", result);
167+
this.fire("saved", result, {prefix:true});
168168
}
169169
},
170170

171171
_handleError: function(error) {
172-
this.fire("error", error);
172+
this.fire("error", error, {prefix:true});
173173
},
174174

175175
setGlobal: function(key, value) {
@@ -197,13 +197,18 @@
197197
return this._plugin.getConfig("page");
198198
},
199199

200-
fire: function(type, detail) {
201-
if (this._eventPrefix) {
200+
fire: function(type, detail, options) {
201+
if (this._eventPrefix && DataUtils.getPathValue('prefix', options)) {
202202
type = this._eventPrefix + type;
203203
}
204-
var e = new CustomEvent(type, {detail:detail});
205-
this.dispatchEvent(e);
206-
},
204+
if (this.is) {
205+
Polymer.Base.fire.call(this, type, detail, options);
206+
} else {
207+
//JS Object
208+
var e = new CustomEvent(type, {detail:detail});
209+
this.dispatchEvent(e);
210+
}
211+
}
207212
};
208213

209214
var beh = BehaviorUtils.extend({}, scope.Sync.prototype, {
@@ -221,9 +226,6 @@
221226
},
222227
ready: function() {
223228
scope.Sync.apply(this);
224-
},
225-
fire: function(type, detail) {
226-
Polymer.Base.fire.call(this, this._eventPrefix + type, detail);
227229
}
228230
});
229231

0 commit comments

Comments
 (0)