MCPcopy Index your code
hub / github.com/caseywebdev/react-list / restoreStateOfTarget

Function restoreStateOfTarget

docs/index.js:4887–4952  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

4885var restoreTarget = null,
4886 restoreQueue = null;
4887function restoreStateOfTarget(target) {
4888 var internalInstance = getInstanceFromNode(target);
4889 if (internalInstance && (target = internalInstance.stateNode)) {
4890 var props = target[internalPropsKey] || null;
4891 a: switch (((target = internalInstance.stateNode), internalInstance.type)) {
4892 case "input":
4893 updateInput(
4894 target,
4895 props.value,
4896 props.defaultValue,
4897 props.defaultValue,
4898 props.checked,
4899 props.defaultChecked,
4900 props.type,
4901 props.name
4902 );
4903 internalInstance = props.name;
4904 if ("radio" === props.type && null != internalInstance) {
4905 for (props = target; props.parentNode; ) props = props.parentNode;
4906 props = props.querySelectorAll(
4907 'input[name="' +
4908 escapeSelectorAttributeValueInsideDoubleQuotes(
4909 "" + internalInstance
4910 ) +
4911 '"][type="radio"]'
4912 );
4913 for (
4914 internalInstance = 0;
4915 internalInstance < props.length;
4916 internalInstance++
4917 ) {
4918 var otherNode = props[internalInstance];
4919 if (otherNode !== target && otherNode.form === target.form) {
4920 var otherProps = otherNode[internalPropsKey] || null;
4921 if (!otherProps) throw Error(formatProdErrorMessage(90));
4922 updateInput(
4923 otherNode,
4924 otherProps.value,
4925 otherProps.defaultValue,
4926 otherProps.defaultValue,
4927 otherProps.checked,
4928 otherProps.defaultChecked,
4929 otherProps.type,
4930 otherProps.name
4931 );
4932 }
4933 }
4934 for (
4935 internalInstance = 0;
4936 internalInstance < props.length;
4937 internalInstance++
4938 )
4939 (otherNode = props[internalInstance]),
4940 otherNode.form === target.form && updateValueIfChanged(otherNode);
4941 }
4942 break a;
4943 case "textarea":
4944 updateTextarea(target, props.value, props.defaultValue);

Callers 1

batchedUpdates$1Function · 0.85

Calls 8

getInstanceFromNodeFunction · 0.85
updateInputFunction · 0.85
formatProdErrorMessageFunction · 0.85
updateValueIfChangedFunction · 0.85
updateTextareaFunction · 0.85
updateOptionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…