@@ -25,11 +25,11 @@ function setProps(props, e) {
2525}
2626
2727function image(props, img) {
28− switch (img._0.ctor) {
29− case 'Plain': return plainImage(img._3);
30− case 'Fitted': return fittedImage(props.width, props.height, img._3);
31− case 'Cropped': return croppedImage(img,props.width,props.height,img._3);
32− }
28+ switch (img._0.ctor) {
29+ case 'Plain': return plainImage(img._3);
30+ case 'Fitted': return fittedImage(props.width, props.height, img._3);
31+ case 'Cropped': return croppedImage(img,props.width,props.height,img._3);
32+ }
3333}
3434
3535function plainImage(src) {
@@ -120,21 +120,21 @@ function toPos(pos) {
120120}
121121
122122function setPos(pos,w,h,e) {
123− e.style.position = 'absolute';
124− e.style.margin = 'auto';
125− var transform = '';
126− switch(pos.horizontal.ctor) {
127− case 'P': e.style.right = toPos(pos.x); break;
128− case 'Z': transform = 'translateX(' + ((-w/2)|0) + 'px) ';
129− case 'N': e.style.left = toPos(pos.x); break;
130− }
131− switch(pos.vertical.ctor) {
132− case 'N': e.style.bottom = toPos(pos.y); break;
133− case 'Z': transform += 'translateY(' + ((-h/2)|0) + 'px)';
134− case 'P': e.style.top = toPos(pos.y); break;
135− }
136− if (transform !== '') addTransform(e.style, transform);
137− return e;
123+ e.style.position = 'absolute';
124+ e.style.margin = 'auto';
125+ var transform = '';
126+ switch(pos.horizontal.ctor) {
127+ case 'P': e.style.right = toPos(pos.x); break;
128+ case 'Z': transform = 'translateX(' + ((-w/2)|0) + 'px) ';
129+ case 'N': e.style.left = toPos(pos.x); break;
130+ }
131+ switch(pos.vertical.ctor) {
132+ case 'N': e.style.bottom = toPos(pos.y); break;
133+ case 'Z': transform += 'translateY(' + ((-h/2)|0) + 'px)';
134+ case 'P': e.style.top = toPos(pos.y); break;
135+ }
136+ if (transform !== '') addTransform(e.style, transform);
137+ return e;
138138}
139139
140140function container(pos,elem) {
@@ -168,7 +168,7 @@ function makeElement(e) {
168168
169169function update(node, curr, next) {
170170 if (node.tagName === 'A') { node = node.firstChild; }
171− if (curr.props.id === next.props.id) return false;
171+ if (curr.props.id === next.props.id) return updateProps(node, curr, next);
172172 if (curr.element.ctor !== next.element.ctor) {
173173 node.parentNode.replaceChild(render(next),node);
174174 return true;
@@ -176,7 +176,9 @@ function update(node, curr, next) {
176176 var nextE = next.element, currE = curr.element;
177177 switch(nextE.ctor) {
178178 case "Spacer": break;
179− case "RawHtml": if (nextE._0 !== currE._0) node.innerHTML = nextE._0; break;
179+ case "RawHtml":
180+ if (nextE._0 !== currE._0) node.innerHTML = nextE._0;
181+ break;
180182 case "Image":
181183 if (nextE._0.ctor === 'Plain') {
182184 if (nextE._3 !== currE._3) node.src = nextE._3;
@@ -188,6 +190,8 @@ function update(node, curr, next) {
188190 }
189191 break;
190192 case "Flow":
193+ var arr = fromList(nextE._1);
194+ for (var i = arr.length; i--; ) { arr[i] = arr[i].element.ctor; }
191195 if (nextE._0.ctor !== currE._0.ctor) {
192196 node.parentNode.replaceChild(render(next),node);
193197 return true;
@@ -232,6 +236,10 @@ function update(node, curr, next) {
232236 return node.parentNode.replaceChild(render(next), node);
233237 }
234238 }
239+ updateProps(node, curr, next);
240+}
241+
242+function updateProps(node, curr, next) {
235243 var props = next.props, currP = curr.props, e = node;
236244 if (props.width !== currP.width) e.style.width = (props.width |0) + 'px';
237245 if (props.height !== currP.height) e.style.height = (props.height|0) + 'px';
@@ -240,7 +248,9 @@ function update(node, curr, next) {
240248 }
241249 var nextColor = (props.color.ctor === 'Just' ?
242250 extract(props.color._0) : 'transparent');
243− if (e.style.backgroundColor !== nextColor) e.style.backgroundColor = nextColor;
251+ if (e.style.backgroundColor !== nextColor) {
252+ e.style.backgroundColor = nextColor;
253+ }
244254 if (props.tag !== currP.tag) { e.id = props.tag; }
245255 if (props.href !== currP.href) {
246256 if (currP.href === '') {