Open pascalpp opened 9 years ago
Remembering now: the problem with that solution is that currently FormView doesn't show ElementViews in regions; it assigns them an el
from its DOM tree (as specified by the el
selector in each Element model) and then tells the ElementView to render. This render method makes for a simpler DOM structure, but when a view assumes an el it doesn't automatically update the el's attributes (including the class attribute). Which is why I was adding the className in onElementRender
in the first place.
But we can still make className
configurable using the standard Marionette.View pattern, but assign the result of that in onElementRender
.
This
.element
classname isn't required by the view controller or any other part of the library. It's only added as a CSS hook (it's used by the themes on the demo page, for example.)But other devs might already be using that classname for other things, so I guess that classname should be configurable. Current it gets set in the semi-private
onElementRender
method, but maybe it should just be the defaultclassName
property of the ElementView class. Then if that classname is already in use, the developer can pass in a differentclassName
, or extend ElementView to set a different defaultclassName
.