This is mostly just preference because I prefer to see the whole template in one place rather than spread out between different attributes but in this case I think it helps because if you want a really minimal template you need to be able to put the data-editor attribute on the outer element. Similar to how the template in the Form class works with the data-fieldsets attribute

On 20 Mar 2013, at 20:41, Phil Freo <notifications@github.com> wrote:

> In src/field.js:
> 
> > +    var $field = $(this.template(_.result(this, 'templateData')));
> > +
> > +    if (schema.fieldClass) $field.addClass(schema.fieldClass);
> > +    if (schema.fieldAttrs) $field.attr(schema.fieldAttrs);
> > +
> > +    //Render editor
> > +    $field.find('[data-editor]').add($field).each(function(i, el) {
> > +      var $container = $(el),
> > +          selection = $container.attr('data-editor');
> > +
> > +      if (_.isUndefined(selection)) return;
> > +
> > +      $container.append(editor.render().el);
> > +    });
> > +
> > +    this.setElement($field);
> this seems like a strange pattern
> 
> why not drop the outer div from the html template and use backbone's own default el. (you'd also be able to use className, tagName, etc as expected then)
> 
> then you'd remove this.setElement() here and use this.$el instead of $field elsewhere in this function, since, after all, this IS the field View.
> 
> —
> Reply to this email directly or view it on GitHub.