on master help sign in
Fix issue #230

The problem was that `inner` was not refering to the correct node in the `setPos` expression if the inner node got replaced.

commit984cfc55a93c4f1f0e22905ca716571df1f1413c authorEvan Czaplicki <info@elm-lang.org> dateMon 2 Sep 2013, 01:04 (13 years ago) parent128e21d
1 file changed+4−12
runtime/Render/Element.js+4−12
runtime/Render/Element.js+4−12
@@ -124,6 +124,8 @@ function toPos(pos) {
124124 }
125125}
126126
127+// must clear right, left, top, bottom, and transform
128+// before calling this function
127129function setPos(pos,w,h,e) {
128130 e.style.position = 'absolute';
129131 e.style.margin = 'auto';
@@ -220,18 +222,8 @@ function update(node, curr, next) {
220222 }
221223 break;
222224 case "Container":
223− var inner = node.firstChild;
224− if (!update(inner, currE._1, nextE._1)) {
225− if (nextE._0.horizontal.ctor !== currE._0.horizontal.ctor) {
226− inner.style.left = inner.style.right = 'none';
227− removeTransform(inner.style);
228− }
229− if (nextE._0.vertical.ctor !== currE._0.vertical.ctor) {
230− inner.style.top = inner.style.bottom = 'none';
231− removeTransform(inner.style);
232− }
233− }
234− setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, inner);
225+ update(node.firstChild, currE._1, nextE._1)
226+ setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, node.firstChild);
235227 break;
236228 case "Custom":
237229 if (currE.type === nextE.type) {