sproutcore/sproutcore20 — Issue #209: Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM.
Author: guilhermeaiolfi
Created: 2011-11-16 21:30:08+00:00
State: open

Hi,

I'm trying to migrate my code to the new version (using Metaphor.js). But I'm always getting this error:

Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM.

Here it is a working example that does what I want (old sproutcore):

http://todacidade.com.br/element/add

The error appears when I click in "Adicionar novo telefone" (there is no online example using the new version).

Here is the code that is being called when this button is clicked:

```javascript
addTelephoneToElement : function(btn)
{
var i = this._telephones? this._telephones : 1;
var phone = this.content.addTelephone({name : "Novo Telefone " + i, city_id: 1 });
this._telephones = ++i;
this.set('telephoneSelected', phone);
this.set('editing', true);
},
```
Probably a bug, right? Because it was working.