MCPcopy Create free account
hub / github.com/adobe/react-spectrum / isClientLink

Function isClientLink

packages/dev/s2-docs/src/pageUtils.ts:41–57  ·  view source on GitHub ↗
(link: HTMLAnchorElement)

Source from the content-addressed store, hash-verified

39}
40
41export function isClientLink(link: HTMLAnchorElement) {
42 let baseUrl = process.env.LIBRARY
43 ? getBaseUrl(process.env.LIBRARY as any)
44 : 'http://localhost:1234';
45
46 return (
47 link &&
48 link instanceof HTMLAnchorElement &&
49 link.href &&
50 (!link.target || link.target === '_self') &&
51 link.origin === location.origin &&
52 !link.hasAttribute('download') &&
53 link.href.startsWith(baseUrl) &&
54 !link.href.includes('v3/') && // links with v3 are from the old website
55 !link.pathname.endsWith('.html') // links with .html are from the old website
56 );
57}

Callers 2

registerLinkFunction · 0.90
client.tsxFile · 0.90

Calls 2

hasAttributeMethod · 0.80
getBaseUrlFunction · 0.70

Tested by

no test coverage detected