You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
I'd expect the view in the DOM to be updated with the new information from the model - e.g. the same way this works in the TodoMVC Chaplin-App.
Due to this view being configured with noWrap: true, a call to render only changes the @el and @$el properties of the view instance, but neither removes the old @el from the DOM nor inserts/appends the new one.
Im trying to figure out how this should properly be done. How can i simply rerender a noWrap view on changes?
The text was updated successfully, but these errors were encountered:
I have the problem too. Every render populates the container with a new version of the html.
In Chaplin.View, why do you need to do this when the noWrap option is set:
# Undelegate the container events that were setup.
@undelegateEvents()
# Delegate events to the top-level container in the template.
@setElement el.firstChild, true
The current implementation wraps html returned by the templating function in a div then pulls it out. I believe the correct approach for View#render would be to use the template element and look something like this:
if@noWraptemplate=document.createElement'template'template.innerHTML= html
fragment=template.contentiffragment.children.length>1thrownewError'There must be a single top-level element when '+'using `noWrap`.'# Undelegate the container events that were setup.@undelegateEvents()
# Delegate events to the top-level container in the template.@setElement fragment, trueelse
setHTML (if $ then@$elelse@el), html
Notice how the above avoids the whole wrapping concept altogether. I believe that's the key.
Another approach would be to use of the kind of lame document.createDocumentFragment method to construct DOM nodes programmatically, but that approach would be flimsy and prone to error IMO.
I'd expect the view in the DOM to be updated with the new information from the model - e.g. the same way this works in the TodoMVC Chaplin-App.
Due to this view being configured with
noWrap: true
, a call to render only changes the@el
and@$el
properties of the view instance, but neither removes the old@el
from the DOM nor inserts/appends the new one.Im trying to figure out how this should properly be done. How can i simply rerender a noWrap view on changes?
The text was updated successfully, but these errors were encountered: