MCPcopy Create free account
hub / github.com/caseywebdev/react-list / canHydrateInstance

Function canHydrateInstance

docs/index.js:16922–16984  ·  view source on GitHub ↗
(instance, type, props, inRootOrSingleton)

Source from the content-addressed store, hash-verified

16920 }
16921}
16922function canHydrateInstance(instance, type, props, inRootOrSingleton) {
16923 for (; 1 === instance.nodeType; ) {
16924 var anyProps = props;
16925 if (instance.nodeName.toLowerCase() !== type.toLowerCase()) {
16926 if (
16927 !inRootOrSingleton &&
16928 ("INPUT" !== instance.nodeName || "hidden" !== instance.type)
16929 )
16930 break;
16931 } else if (!inRootOrSingleton)
16932 if ("input" === type && "hidden" === instance.type) {
16933 var name = null == anyProps.name ? null : "" + anyProps.name;
16934 if (
16935 "hidden" === anyProps.type &&
16936 instance.getAttribute("name") === name
16937 )
16938 return instance;
16939 } else return instance;
16940 else if (!instance[internalHoistableMarker])
16941 switch (type) {
16942 case "meta":
16943 if (!instance.hasAttribute("itemprop")) break;
16944 return instance;
16945 case "link":
16946 name = instance.getAttribute("rel");
16947 if ("stylesheet" === name && instance.hasAttribute("data-precedence"))
16948 break;
16949 else if (
16950 name !== anyProps.rel ||
16951 instance.getAttribute("href") !==
16952 (null == anyProps.href ? null : anyProps.href) ||
16953 instance.getAttribute("crossorigin") !==
16954 (null == anyProps.crossOrigin ? null : anyProps.crossOrigin) ||
16955 instance.getAttribute("title") !==
16956 (null == anyProps.title ? null : anyProps.title)
16957 )
16958 break;
16959 return instance;
16960 case "style":
16961 if (instance.hasAttribute("data-precedence")) break;
16962 return instance;
16963 case "script":
16964 name = instance.getAttribute("src");
16965 if (
16966 (name !== (null == anyProps.src ? null : anyProps.src) ||
16967 instance.getAttribute("type") !==
16968 (null == anyProps.type ? null : anyProps.type) ||
16969 instance.getAttribute("crossorigin") !==
16970 (null == anyProps.crossOrigin ? null : anyProps.crossOrigin)) &&
16971 name &&
16972 instance.hasAttribute("async") &&
16973 !instance.hasAttribute("itemprop")
16974 )
16975 break;
16976 return instance;
16977 default:
16978 return instance;
16979 }

Callers 1

beginWorkFunction · 0.85

Calls 2

getNextHydratableFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…