"use strict"

function denormalizeResult(result) {
  let {insert, remove} = result;
  let elements = {};
  for(let ins of insert) {
    let [entity, attribute, value] = ins;
  }
  for(let rem of remove) {
    let [entity, attribute, value] = rem;
    
  }
}

@@ -87,22 +87,71 @@
 let 
-elements = %7B%7D;
+additions = %7B%7D;%0A  // build up a representation of the additions
 %0A  f
@@ -222,86 +222,776 @@
 ;%0A  
-%7D%0A  for(let rem of remove) %7B%0A    let %5Bentity, attribute, value%5D = rem;%0A    %0A  %7D
+  if(!additions%5Bentity%5D) additions%5Bentity%5D = %7B%7D%0A    switch(attribute) %7B%0A      case %22tag%22:%0A        break;%0A      case %22children%22:%0A        break;%0A      case %22text%22:%0A        attribute = %22textContent%22%0A        break;%0A      case %22parent%22:%0A        break;%0A    %7D%0A    additions%5Bentity%5D%5Battribute%5D = value%0A  %7D%0A  // do removes that aren't just going to be overwritten by%0A  // the adds%0A  for(let rem of remove) %7B%0A    let %5Bentity, attribute, value%5D = rem;%0A    switch(attribute) %7B%0A      case %22children%22:%0A        break;%0A      case %22text%22:%0A        attribute = %22textContent%22%0A        break;%0A      case %22parent%22:%0A        break;%0A    %7D%0A  %7D%0A%0A  let entities = Object.keys(changes)%0A  for(let ent of entities) %7B%0A    let attributes = Object.keys(ent);%0A    for(let attr of attributes) %7B%0A%0A    %7D%0A  %7D%0A
 %0A%7D%0A

add scaffolding to renderer