on master help sign in
Get rid of silly alias (e => node)
commit23de1c30aa1ff5cc674c9ef92a06fe8a5810bd94 authorEvan Czaplicki <info@elm-lang.org> dateThu 24 Jul 2014, 18:59 (12 years ago) parent6325b7e
1 file changed+16−17
runtime/Render/Element.js+16−17
runtime/Render/Element.js+16−17
@@ -356,25 +356,24 @@ function update(node, curr, next) {
356356function updateProps(node, curr, next) {
357357 var props = next.props;
358358 var currP = curr.props;
359− var e = node;
360359 var element = next.element;
361360 var width = props.width - (element.adjustWidth || 0);
362361 var height = props.height - (element.adjustHeight || 0);
363362 if (width !== currP.width) {
364− e.style.width = (width|0) + 'px';
363+ node.style.width = (width|0) + 'px';
365364 }
366365 if (height !== currP.height) {
367− e.style.height = (height|0) + 'px';
366+ node.style.height = (height|0) + 'px';
368367 }
369368 if (props.opacity !== currP.opacity) {
370− e.style.opacity = props.opacity;
369+ node.style.opacity = props.opacity;
371370 }
372371 var nextColor = (props.color.ctor === 'Just' ?
373372 colorToCss(props.color._0) : '');
374− if (e.style.backgroundColor !== nextColor) {
375− e.style.backgroundColor = (nextColor === '' ? 'transparent' : nextColor);
373+ if (node.style.backgroundColor !== nextColor) {
374+ node.style.backgroundColor = (nextColor === '' ? 'transparent' : nextColor);
376375 }
377− if (props.tag !== currP.tag) { e.id = props.tag; }
376+ if (props.tag !== currP.tag) { node.id = props.tag; }
378377 if (props.href !== currP.href) {
379378 if (currP.href === '') {
380379 var a = newElement('a');
@@ -385,9 +384,9 @@ function updateProps(node, curr, next) {
385384 a.style.left = 0;
386385 a.style.display = 'block';
387386 a.style.position = 'absolute';
388− e.style.position = 'relative';
387+ node.style.position = 'relative';
389388 a.style.pointerEvents = 'auto';
390− e.appendChild(a);
389+ node.appendChild(a);
391390 } else {
392391 node.lastNode.href = props.href;
393392 }
@@ -395,20 +394,20 @@ function updateProps(node, curr, next) {
395394
396395 // update hover handlers
397396 if (props.hover.ctor === '_Tuple0') {
398− removeHover(e);
399− } else if (e.elm_hover_handler) {
400− e.elm_hover_handler = props.hover;
397+ removeHover(node);
398+ } else if (node.elm_hover_handler) {
399+ node.elm_hover_handler = props.hover;
401400 } else {
402− addHover(e, props.hover);
401+ addHover(node, props.hover);
403402 }
404403
405404 // update click handlers
406405 if (props.click.ctor === '_Tuple0') {
407− removeClick(e);
408− } else if (e.elm_click_handler) {
409− e.elm_click_handler = props.click;
406+ removeClick(node);
407+ } else if (node.elm_click_handler) {
408+ node.elm_click_handler = props.click;
410409 } else {
411− addClick(e, props.click);
410+ addClick(node, props.click);
412411 }
413412}
414413