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

Function isClientLink

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

Source from the content-addressed store, hash-verified

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

Callers 2

registerLinkFunction · 0.90
client.tsxFile · 0.90

Calls 2

hasAttributeMethod · 0.80
getBaseUrlFunction · 0.70

Tested by

no test coverage detected