Send or not send, elin the constructor
I think it is always possible that it is better to send elin the constructor, so the JS logic will be more decoupled from the DOM structure, and not any DOM element name is hardcoded in the JS code.
, DOM , DOM , DOM DOM.
.
this.$el
, :
this.$el
VS
$(this.el)
- , . jQuery , DOM DOM jQuery, this.$el, .
render()
@muistooshort, this. , render() , , el, el , this.
, :
$('#header').html(new HeaderView().render())
:
$('#header').html(new HeaderView().render().el)