documentcloud/backbone — Issue #923: Should View constructor options.el support jQuery object?
Author: salomvary
Created: 2012-02-01 14:30:38+00:00
State: open

When doing `new MyView({el:$("#myID")})` the instance will end up having both this.el and this.$el being jQuery objects. `options.el` should handle both native DOM elements and jQuery/Zepto objects and set `el` and `$el` properly as does View.setElement.

Another interesting side-effect is that setting this.el to jQuery object will silently work when not using any native DOM methods on it. This might even be a feature that makes this.$el unnecessary when used consistently. (Note: backbone itself does not use any native DOM methods on this.el.)