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

Function preconnectAs

docs/index.js:17083–17101  ·  view source on GitHub ↗
(rel, href, crossOrigin)

Source from the content-addressed store, hash-verified

17081}
17082var globalDocument = "undefined" === typeof document ? null : document;
17083function preconnectAs(rel, href, crossOrigin) {
17084 var ownerDocument = globalDocument;
17085 if (ownerDocument && "string" === typeof href && href) {
17086 var limitedEscapedHref =
17087 escapeSelectorAttributeValueInsideDoubleQuotes(href);
17088 limitedEscapedHref =
17089 'link[rel="' + rel + '"][href="' + limitedEscapedHref + '"]';
17090 "string" === typeof crossOrigin &&
17091 (limitedEscapedHref += '[crossorigin="' + crossOrigin + '"]');
17092 preconnectsSet.has(limitedEscapedHref) ||
17093 (preconnectsSet.add(limitedEscapedHref),
17094 (rel = { rel: rel, crossOrigin: crossOrigin, href: href }),
17095 null === ownerDocument.querySelector(limitedEscapedHref) &&
17096 ((href = ownerDocument.createElement("link")),
17097 setInitialProperties(href, "link", rel),
17098 markNodeAsHoistable(href),
17099 ownerDocument.head.appendChild(href)));
17100 }
17101}
17102function prefetchDNS(href) {
17103 previousDispatcher.D(href);
17104 preconnectAs("dns-prefetch", href, null);

Callers 3

prefetchDNSFunction · 0.85
preconnectFunction · 0.85
index.jsFile · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…