Skip to content

Commit

Permalink
Prevent overwrite on view registration
Browse files Browse the repository at this point in the history
See #1553
  • Loading branch information
wagenet committed Feb 1, 2013
1 parent eaf2651 commit 04df12c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/ember-views/lib/views/view.js
Expand Up @@ -58,7 +58,10 @@ Ember.CoreView = Ember.Object.extend(Ember.Evented, {

// Register the view for event handling. This hash is used by
// Ember.EventDispatcher to dispatch incoming events.
if (!this.isVirtual) Ember.View.views[this.elementId] = this;
if (!this.isVirtual) {
Ember.assert("Attempted to register a view with an id already in use: "+this.elementId, !Ember.View.views[this.elementId]);
Ember.View.views[this.elementId] = this;
}

this.addBeforeObserver('elementId', function() {
throw new Error("Changing a view's elementId after creation is not allowed");
Expand Down

1 comment on commit 04df12c

@tomdrn
Copy link

@tomdrn tomdrn commented on 04df12c Feb 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked a question directly related to this commit : http://stackoverflow.com/questions/15000073/attempted-to-register-a-view-with-an-id-already-in-use

@wagenet Should we consider this as a bug ?

Please sign in to comment.