I see that morphing is only possible when we are refreshing the page. There are cases when it would be super useful to have morphing capabilities when URL changes (e.g. search forms).
With morphing it is also easy to skip morphing for specific HTML objects (e.g. on forms with complex filters e.g. colorpicker, datepicker, html dropdowns etc).
I am using simple script to achieve this and I wonder why is something like this not part of Turbo 8 core? Morphing could be executed only when e.g. <meta name="turbo-visit-method" content="morph">
exists.
PageRenderer.prototype.assignNewBody = function () {
if (document.body) {
morphdom(document.body, this.newElement, {
onBeforeElUpdated: (fromEl, toEl) => {
if (fromEl.dataset.morphSkip) {
return false;
}
if (fromEl.isEqualNode(toEl)) {
return false;
}
return true;
},
});
}
};