seanmonstar/Shipyard — Issue #22: View DOM events
Author: seanmonstar
Created: 2012-02-11 01:43:04+00:00
State: open
Labels: feature

Views need an elegant way to register events for the elements inside them, without being sure when the elements will be rendered, and that the elements can be destroyed and re-created.

Element Delegation is likely the best solution, and probably something should set up delegation if a View class is required.

They must support 3 different ways of assigning events:

1. As methods in the Class description. Example:

```js
new Class({
Extends: View,
onClick: function() {}
});
```

2. Adding listeners at instantiation:

```js
var view = new View({
onClick: fn
});
```

3. Adding listeners the normal way:

```js
var view = new View();
view.addListener('click', fn);
```