attrs.ts — vue Source File
Architecture documentation for attrs.ts, a typescript file in the vue codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4250c294_bc81_e422_3fed_02381dc61714["attrs.ts"] 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] 4250c294_bc81_e422_3fed_02381dc61714 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b style 4250c294_bc81_e422_3fed_02381dc61714 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { makeMap } from 'shared/util'
// these are reserved for web because they are directly compiled away
// during template compilation
export const isReservedAttr = makeMap('style,class')
// attributes that should be using props for binding
const acceptValue = makeMap('input,textarea,option,select,progress')
export const mustUseProp = (
tag: string,
type?: string | null,
attr?: string
): boolean => {
return (
(attr === 'value' && acceptValue(tag) && type !== 'button') ||
(attr === 'selected' && tag === 'option') ||
(attr === 'checked' && tag === 'input') ||
(attr === 'muted' && tag === 'video')
)
}
export const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck')
const isValidContentEditableValue = makeMap(
'events,caret,typing,plaintext-only'
)
export const convertEnumeratedValue = (key: string, value: any) => {
return isFalsyAttrValue(value) || value === 'false'
? 'false'
: // allow arbitrary string value for contenteditable
key === 'contenteditable' && isValidContentEditableValue(value)
? value
: 'true'
}
export const isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
'required,reversed,scoped,seamless,selected,sortable,' +
'truespeed,typemustmatch,visible'
)
export const xlinkNS = 'http://www.w3.org/1999/xlink'
export const isXlink = (name: string): boolean => {
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
}
export const getXlinkProp = (name: string): string => {
return isXlink(name) ? name.slice(6, name.length) : ''
}
export const isFalsyAttrValue = (val: any): boolean => {
return val == null || val === false
}
Domain
Subdomains
Dependencies
- util
Source
Frequently Asked Questions
What does attrs.ts do?
attrs.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Instance subdomain.
What functions are defined in attrs.ts?
attrs.ts defines 5 function(s): convertEnumeratedValue, getXlinkProp, isFalsyAttrValue, isXlink, mustUseProp.
What does attrs.ts depend on?
attrs.ts imports 1 module(s): util.
Where is attrs.ts in the architecture?
attrs.ts is located at src/platforms/web/util/attrs.ts (domain: VueCore, subdomain: Instance, directory: src/platforms/web/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free