@@ -28,20 +28,6 @@ function setProps(elem, node) {
2828 node.id = props.tag;
2929 }
3030
31− if (props.href !== '') {
32− var a = newElement('a');
33− a.href = props.href;
34− a.style.width = '100%';
35− a.style.height = '100%';
36− a.style.top = 0;
37− a.style.left = 0;
38− a.style.display = 'block';
39− a.style.position = 'absolute';
40− node.style.position = 'relative';
41− a.style.pointerEvents = 'auto';
42− node.appendChild(a);
43− }
44−
4531 if (props.hover.ctor !== '_Tuple0') {
4632 addHover(node, props.hover);
4733 }
@@ -50,6 +36,15 @@ function setProps(elem, node) {
5036 addClick(node, props.click);
5137 }
5238
39+ if (props.href !== '') {
40+ var anchor = newElement('a');
41+ anchor.href = props.href;
42+ anchor.style.display = 'block';
43+ anchor.style.pointerEvents = 'auto';
44+ anchor.appendChild(node);
45+ node = anchor;
46+ }
47+
5348 return node;
5449}
5550
@@ -394,19 +389,21 @@ function updateProps(node, curr, next) {
394389
395390 if (nextProps.href !== currProps.href) {
396391 if (currProps.href === '') {
397− var a = newElement('a');
398− a.href = nextProps.href;
399− a.style.width = '100%';
400− a.style.height = '100%';
401− a.style.top = 0;
402− a.style.left = 0;
403− a.style.display = 'block';
404− a.style.position = 'absolute';
405− node.style.position = 'relative';
406− a.style.pointerEvents = 'auto';
407− node.appendChild(a);
392+ // add a surrounding href
393+ var anchor = newElement('a');
394+ anchor.href = nextProps.href;
395+ anchor.style.display = 'block';
396+ anchor.style.pointerEvents = 'auto';
397+
398+ node.parentNode.replaceChild(anchor, node);
399+ anchor.appendChild(node);
400+ } else if (nextProps.href === '') {
401+ // remove the surrounding href
402+ var anchor = node.parentNode;
403+ anchor.parentNode.replaceChild(node, anchor);
408404 } else {
409− node.lastNode.href = nextProps.href;
405+ // just update the link
406+ node.parentNode.href = nextProps.href;
410407 }
411408 }
412409