Home / File/ element.ts — vue Source File

element.ts — vue Source File

Architecture documentation for element.ts, a typescript file in the vue codebase. 2 imports, 0 dependents.

File typescript VueCore VDom 2 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  028f64f4_ee84_70c6_fa80_a34e92d154ee["element.ts"]
  1ec7e50f_8f20_0656_28f0_45cecc26cf74["env"]
  028f64f4_ee84_70c6_fa80_a34e92d154ee --> 1ec7e50f_8f20_0656_28f0_45cecc26cf74
  09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"]
  028f64f4_ee84_70c6_fa80_a34e92d154ee --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b
  style 028f64f4_ee84_70c6_fa80_a34e92d154ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { inBrowser } from 'core/util/env'
import { makeMap } from 'shared/util'

export const namespaceMap = {
  svg: 'http://www.w3.org/2000/svg',
  math: 'http://www.w3.org/1998/Math/MathML'
}

export const isHTMLTag = makeMap(
  'html,body,base,head,link,meta,style,title,' +
    'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
    'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
    'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
    's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
    'embed,object,param,source,canvas,script,noscript,del,ins,' +
    'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
    'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
    'output,progress,select,textarea,' +
    'details,dialog,menu,menuitem,summary,' +
    'content,element,shadow,template,blockquote,iframe,tfoot'
)

// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
export const isSVG = makeMap(
  'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
    'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
    'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  true
)

export const isPreTag = (tag?: string): boolean => tag === 'pre'

export const isReservedTag = (tag: string): boolean | undefined => {
  return isHTMLTag(tag) || isSVG(tag)
}

export function getTagNamespace(tag: string): string | undefined {
  if (isSVG(tag)) {
    return 'svg'
  }
  // basic support for MathML
  // note it doesn't support other MathML elements being component roots
  if (tag === 'math') {
    return 'math'
  }
}

const unknownElementCache = Object.create(null)
export function isUnknownElement(tag: string): boolean {
  /* istanbul ignore if */
  if (!inBrowser) {
    return true
  }
  if (isReservedTag(tag)) {
    return false
  }
  tag = tag.toLowerCase()
  /* istanbul ignore if */
  if (unknownElementCache[tag] != null) {
    return unknownElementCache[tag]
  }
  const el = document.createElement(tag)
  if (tag.indexOf('-') > -1) {
    // https://stackoverflow.com/a/28210364/1070244
    return (unknownElementCache[tag] =
      el.constructor === window.HTMLUnknownElement ||
      el.constructor === window.HTMLElement)
  } else {
    return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  }
}

export const isTextInputType = makeMap(
  'text,number,password,search,email,tel,url'
)

Domain

Subdomains

Dependencies

  • env
  • util

Frequently Asked Questions

What does element.ts do?
element.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in element.ts?
element.ts defines 4 function(s): getTagNamespace, isPreTag, isReservedTag, isUnknownElement.
What does element.ts depend on?
element.ts imports 2 module(s): env, util.
Where is element.ts in the architecture?
element.ts is located at src/platforms/web/util/element.ts (domain: VueCore, subdomain: VDom, 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