on master help sign in
give curr and next properties parallel names
commitc39056f50b4179b395ece5d1e7e092d2c55f8c1a authorEvan Czaplicki <info@elm-lang.org> dateThu 24 Jul 2014, 19:04 (12 years ago) parent23de1c3
1 file changed+21−21
runtime/Render/Element.js+21−21
runtime/Render/Element.js+21−21
@@ -354,30 +354,30 @@ function update(node, curr, next) {
354354}
355355
356356function updateProps(node, curr, next) {
357− var props = next.props;
358− var currP = curr.props;
357+ var nextProps = next.props;
358+ var currProps = curr.props;
359359 var element = next.element;
360− var width = props.width - (element.adjustWidth || 0);
361− var height = props.height - (element.adjustHeight || 0);
362− if (width !== currP.width) {
360+ var width = nextProps.width - (element.adjustWidth || 0);
361+ var height = nextProps.height - (element.adjustHeight || 0);
362+ if (width !== currProps.width) {
363363 node.style.width = (width|0) + 'px';
364364 }
365− if (height !== currP.height) {
365+ if (height !== currProps.height) {
366366 node.style.height = (height|0) + 'px';
367367 }
368− if (props.opacity !== currP.opacity) {
369− node.style.opacity = props.opacity;
368+ if (nextProps.opacity !== currProps.opacity) {
369+ node.style.opacity = nextProps.opacity;
370370 }
371− var nextColor = (props.color.ctor === 'Just' ?
372− colorToCss(props.color._0) : '');
371+ var nextColor = (nextProps.color.ctor === 'Just' ?
372+ colorToCss(nextProps.color._0) : '');
373373 if (node.style.backgroundColor !== nextColor) {
374374 node.style.backgroundColor = (nextColor === '' ? 'transparent' : nextColor);
375375 }
376− if (props.tag !== currP.tag) { node.id = props.tag; }
377− if (props.href !== currP.href) {
378− if (currP.href === '') {
376+ if (nextProps.tag !== currProps.tag) { node.id = nextProps.tag; }
377+ if (nextProps.href !== currProps.href) {
378+ if (currProps.href === '') {
379379 var a = newElement('a');
380− a.href = props.href;
380+ a.href = nextProps.href;
381381 a.style.width = '100%';
382382 a.style.height = '100%';
383383 a.style.top = 0;
@@ -388,26 +388,26 @@ function updateProps(node, curr, next) {
388388 a.style.pointerEvents = 'auto';
389389 node.appendChild(a);
390390 } else {
391− node.lastNode.href = props.href;
391+ node.lastNode.href = nextProps.href;
392392 }
393393 }
394394
395395 // update hover handlers
396− if (props.hover.ctor === '_Tuple0') {
396+ if (nextProps.hover.ctor === '_Tuple0') {
397397 removeHover(node);
398398 } else if (node.elm_hover_handler) {
399− node.elm_hover_handler = props.hover;
399+ node.elm_hover_handler = nextProps.hover;
400400 } else {
401− addHover(node, props.hover);
401+ addHover(node, nextProps.hover);
402402 }
403403
404404 // update click handlers
405− if (props.click.ctor === '_Tuple0') {
405+ if (nextProps.click.ctor === '_Tuple0') {
406406 removeClick(node);
407407 } else if (node.elm_click_handler) {
408− node.elm_click_handler = props.click;
408+ node.elm_click_handler = nextProps.click;
409409 } else {
410− addClick(node, props.click);
410+ addClick(node, nextProps.click);
411411 }
412412}
413413