MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / checkDistinguishable

Function checkDistinguishable

plugins/UiPluginManager/media/js/all.js:502–523  ·  view source on GitHub ↗
(childNodes, indexToCheck, parentVNode, operation)

Source from the content-addressed store, hash-verified

500 }
501 };
502 var checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {
503 var childNode = childNodes[indexToCheck];
504 if (childNode.vnodeSelector === '') {
505 return; // Text nodes need not be distinguishable
506 }
507 var properties = childNode.properties;
508 var key = properties ? properties.key === undefined ? properties.bind : properties.key : undefined;
509 if (!key) {
510 for (var i = 0; i < childNodes.length; i++) {
511 if (i !== indexToCheck) {
512 var node = childNodes[i];
513 if (same(node, childNode)) {
514 if (operation === 'added') {
515 throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' + 'added, but there is now more than one. You must add unique key properties to make them distinguishable.');
516 } else {
517 throw new Error(parentVNode.vnodeSelector + ' had a ' + childNode.vnodeSelector + ' child ' + 'removed, but there were more than one. You must add unique key properties to make them distinguishable.');
518 }
519 }
520 }
521 }
522 }
523 };
524 var createDom;
525 var updateDom;
526 var updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {

Callers 1

updateChildrenFunction · 0.70

Calls 1

sameFunction · 0.70

Tested by

no test coverage detected