create diffs directly against the current DOM

This commit is contained in:
2024-11-01 08:49:41 -05:00
committed by Joel Wetzell
parent e02a7d7819
commit 71c34eecbf
+2 -4
View File
@@ -50,8 +50,7 @@ function drawDeviceFrame(id) {
</html>
`;
d.contentBodyVNode = h('body', convertHtml(generateBodyHTML(d)));
d.contentBodyElement = create(d.contentBodyVNode);
d.contentBodyElement = create(h('body', convertHtml(generateBodyHTML(d))));
$deviceDrawArea.setAttribute('class', `${d.type} draw-area`);
$deviceDrawArea.contentWindow.document.open();
@@ -109,9 +108,8 @@ module.exports.draw = function draw(device) {
if (d.contentBodyElement) {
const newVNode = h('body', convertHtml(generateBodyHTML(d)));
const domPatches = diff(d.contentBodyVNode, newVNode);
const domPatches = diff(d.contentBodyElement, newVNode);
d.contentBodyElement = patch(d.contentBodyElement, domPatches);
d.contentBodyVNode = newVNode;
} else {
drawDeviceFrame(d.id);
}