airbnb/rendr — pull request #250 by rcs (2014-01-03 11:34:01+00:00)
Title: View Adapter -- Extract Rendr behavior from Backbone.View behavior.

This extracts some of base/view's functionality into a ViewAdapter, with a goal of making it feasible to use other View producing technologies with rendr. (React.js in my case.) There's an additional class method that all Rendr-view-making-things have to allow, "attachNewInstance", which is what is called from the top level attach to allow a different instantiation and attachment strategy.

BaseView's getHtml and ViewEngine's getViewHtml change to an async style to allow for view technologies that need it.

The viewAdapter is attached to the app instance, which has the side effect of cleaning up plugin code like in- rcs/rendr-handlebars@9291d0cb53a0509629e8d91e3ccceb395a5cc261 .

ViewAdapter.attach (previously BaseView.attach) has a functionality change. Instead of finding all [data-view] objects and trying to attach them, it finds the top level [data-view] elements inside the given scope.

There's still the `parentView.$el` in attach to deal with, since non-backbone-views don't have an $el, but it's not necessary for me just yet. Suggestions on how to implement that interface are appreciated.

Tests pass, and sample apps seem to work dandy. Does require my rendr-handlebars fork.