common.ts
This file
Path
src/jsx/intrinsic-element/common.ts
23 lines 路 650 bytes 路 TypeScript
Last changed by
Not known.
History of this fileTake it
123456789101112131415161718192021222324import type { Props } from '../base'
export const deDupeKeyMap: Record<string, string[]> = { title: [], script: ['src'], style: ['data-href'], link: ['href'], meta: ['name', 'httpEquiv', 'charset', 'itemProp'],}
export const domRenderers: Record<string, Function> = {}
export const dataPrecedenceAttr = 'data-precedence'
export const isStylesheetLinkWithPrecedence = (props: Props): boolean => props.rel === 'stylesheet' && 'precedence' in props
export const shouldDeDupeByKey = (tagName: string, supportSort: boolean): boolean => { if (tagName === 'link') { return supportSort } return deDupeKeyMap[tagName].length > 0}