Skip to content

Commit f06749a

Browse files
committed
updated dependencies
1 parent a0e9ca2 commit f06749a

File tree

5 files changed

+32
-31
lines changed

5 files changed

+32
-31
lines changed

esm.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ var hyperHTML = (function (document) {
198198
var next = function next(get, list, i, length, before) {
199199
return i < length ? get(list[i], 0) : 0 < i ? get(list[i - 1], -0).nextSibling : before;
200200
};
201-
var remove = function remove(get, parent, children, start, end) {
201+
var remove = function remove(get, children, start, end) {
202202
while (start < end) {
203-
_removeChild(get(children[start++], -1), parent);
203+
drop(get(children[start++], -1));
204204
}
205205
}; // - - - - - - - - - - - - - - - - - - -
206206
// diff related constants and utilities
@@ -399,7 +399,7 @@ var hyperHTML = (function (document) {
399399

400400
case DELETION:
401401
// TODO: bulk removes for sequential nodes
402-
if (live.has(currentNodes[currentStart])) currentStart++;else remove(get, parentNode, currentNodes, currentStart++, currentStart);
402+
if (live.has(currentNodes[currentStart])) currentStart++;else remove(get, currentNodes, currentStart++, currentStart);
403403
break;
404404
}
405405
}
@@ -421,22 +421,17 @@ var hyperHTML = (function (document) {
421421
applyDiff(OND(futureNodes, futureStart, futureChanges, currentNodes, currentStart, currentChanges, compare) || HS(futureNodes, futureStart, futureEnd, futureChanges, currentNodes, currentStart, currentEnd, currentChanges), get, parentNode, futureNodes, futureStart, currentNodes, currentStart, currentLength, before);
422422
};
423423

424-
var _removeChild = function removeChild(child, parentNode) {
425-
/* istanbul ignore if */
426-
if ('remove' in child) {
427-
_removeChild = function removeChild(child) {
428-
child.remove();
429-
};
430-
} else {
431-
_removeChild = function removeChild(child, parentNode) {
432-
/* istanbul ignore else */
433-
if (child.parentNode === parentNode) parentNode.removeChild(child);
434-
};
435-
}
436-
437-
_removeChild(child, parentNode);
424+
var drop = function drop(node) {
425+
return (node.remove || dropChild).call(node);
438426
};
439427

428+
function dropChild() {
429+
var parentNode = this.parentNode;
430+
/* istanbul ignore else */
431+
432+
if (parentNode) parentNode.removeChild(this);
433+
}
434+
440435
/*! (c) 2018 Andrea Giammarchi (ISC) */
441436

442437
var domdiff = function domdiff(parentNode, // where changes happen
@@ -480,7 +475,7 @@ var hyperHTML = (function (document) {
480475

481476

482477
if (futureSame && currentStart < currentEnd) {
483-
remove(get, parentNode, currentNodes, currentStart, currentEnd);
478+
remove(get, currentNodes, currentStart, currentEnd);
484479
return futureNodes;
485480
}
486481

@@ -502,8 +497,8 @@ var hyperHTML = (function (document) {
502497
i = indexOf(currentNodes, currentStart, currentEnd, futureNodes, futureStart, futureEnd, compare); // outer diff
503498

504499
if (-1 < i) {
505-
remove(get, parentNode, currentNodes, currentStart, i);
506-
remove(get, parentNode, currentNodes, i + futureChanges, currentEnd);
500+
remove(get, currentNodes, currentStart, i);
501+
remove(get, currentNodes, i + futureChanges, currentEnd);
507502
return futureNodes;
508503
}
509504
} // common case with one replacement for many nodes
@@ -514,7 +509,7 @@ var hyperHTML = (function (document) {
514509

515510
if (currentChanges < 2 || futureChanges < 2) {
516511
append(get, parentNode, futureNodes, futureStart, futureEnd, get(currentNodes[currentStart], 0));
517-
remove(get, parentNode, currentNodes, currentStart, currentEnd);
512+
remove(get, currentNodes, currentStart, currentEnd);
518513
return futureNodes;
519514
} // the half match diff part has been skipped in petit-dom
520515
// https://github.com/yelouafi/petit-dom/blob/bd6f5c919b5ae5297be01612c524c40be45f14a7/src/vdom.js#L391-L397

0 commit comments

Comments
 (0)