Skip to content

Commit 4d09149

Browse files
author
Christopher Rombach
committed
Trigger the "changeId" event only if prevId is different from this.id.
1 parent 4e64208 commit 4d09149

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backbone.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,9 @@
523523
if (this.idAttribute in attrs) {
524524
var prevId = this.id;
525525
this.id = this.get(this.idAttribute);
526-
this.trigger('changeId', this, prevId, options);
526+
if(this.id !== prevId) {
527+
this.trigger('changeId', this, prevId, options);
528+
}
527529
}
528530

529531
// Trigger all relevant attribute changes.

0 commit comments

Comments
 (0)