zepheira/exhibit3 — pull request #72 by karger (2012-08-03 19:27:15+00:00)
Title: 2012 08 13 view panel

Modified viewpanel to render views inside the tags that specify them.

Previously, views were rendered in a separately created "view container" that was not a child of the tag specifying the view. Thus, attributes specified on the view tag (e.g. classes for styling) would not apply to the rendered view. Which made it more difficult for an author to style those views. In the new version, the view container is placed inside the tag that specified the view.

If the selected view was defined programmatically, rather than by a tag, then the view container is placed as an immediate child of the view panel tag.

The current solution is imperfect. To render a view, the viewpanel empties the target div, which destroys contextual information such as lenses intended for the view. For standalone views this is ok, as the view is rendered only once. However, the viewpanel re-creates a view each time that view is selected; the
second rendering will no longer have the context. To circumvent this problem, a new div is created inside the view tag to hold the rendered view. Thus, when it is emptied for the next rendering, the remaining content of the view tag is undisturbed.

On the downside, this means that standalone views render in a slightly different way than views in viewpanels---those in viewpanels are nested inside a view container that is not present in standalone views.
However, this is still a significant improvement over the previous approach, where the rendered view was not inside the viewtag at all.

Longer-term, it seems beneficial for every view to render its content inside a newly-created, nested view container div. This would provide consistency while still shielding the rendering and the original
specification-content of the view tag from each other.

Note jslint is throwing tons of errors, but not from my new code. In particular, the .create method (which exhibit never uses) is clearly broken since it references an undefined variable (view).