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

Function checkDistinguishable

plugins/UiConfig/media/js/all.js:499–520  ·  view source on GitHub ↗
(childNodes, indexToCheck, parentVNode, operation)

Source from the content-addressed store, hash-verified

497 }
498 };
499 var checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {
500 var childNode = childNodes[indexToCheck];
501 if (childNode.vnodeSelector === '') {
502 return; // Text nodes need not be distinguishable
503 }
504 var properties = childNode.properties;
505 var key = properties ? properties.key === undefined ? properties.bind : properties.key : undefined;
506 if (!key) {
507 for (var i = 0; i < childNodes.length; i++) {
508 if (i !== indexToCheck) {
509 var node = childNodes[i];
510 if (same(node, childNode)) {
511 if (operation === 'added') {
512 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.');
513 } else {
514 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.');
515 }
516 }
517 }
518 }
519 }
520 };
521 var createDom;
522 var updateDom;
523 var updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {

Callers 1

updateChildrenFunction · 0.70

Calls 1

sameFunction · 0.70

Tested by

no test coverage detected