Home / File/ html-parser.ts — vue Source File

html-parser.ts — vue Source File

Architecture documentation for html-parser.ts, a typescript file in the vue codebase. 4 imports, 1 dependents.

File typescript VueCore Observer 4 imports 1 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  3e4fe868_3184_a713_88c2_eb0e9a4c1aec["html-parser.ts"]
  09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"]
  3e4fe868_3184_a713_88c2_eb0e9a4c1aec --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b
  f97ffecf_bd6b_1d38_1fcb_21dbc0ef2524["util"]
  3e4fe868_3184_a713_88c2_eb0e9a4c1aec --> f97ffecf_bd6b_1d38_1fcb_21dbc0ef2524
  bce9f35d_9d67_0066_6c6a_a292b33b6f29["lang"]
  3e4fe868_3184_a713_88c2_eb0e9a4c1aec --> bce9f35d_9d67_0066_6c6a_a292b33b6f29
  a80b8e3b_d720_9146_3bf6_594d4ee5dd77["compiler"]
  3e4fe868_3184_a713_88c2_eb0e9a4c1aec --> a80b8e3b_d720_9146_3bf6_594d4ee5dd77
  101d3d34_ac07_228f_62b9_5d5ac4a0ea2e["index.ts"]
  101d3d34_ac07_228f_62b9_5d5ac4a0ea2e --> 3e4fe868_3184_a713_88c2_eb0e9a4c1aec
  style 3e4fe868_3184_a713_88c2_eb0e9a4c1aec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Not type-checking this file because it's mostly vendor code.
 */

/*!
 * HTML Parser By John Resig (ejohn.org)
 * Modified by Juriy "kangax" Zaytsev
 * Original code by Erik Arvidsson (MPL-1.1 OR Apache-2.0 OR GPL-2.0-or-later)
 * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
 */

import { makeMap, no } from 'shared/util'
import { isNonPhrasingTag } from 'web/compiler/util'
import { unicodeRegExp } from 'core/util/lang'
import { ASTAttr, CompilerOptions } from 'types/compiler'

// Regular Expressions for parsing tags and attributes
const attribute =
  /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
const dynamicArgAttribute =
  /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeRegExp.source}]*`
const qnameCapture = `((?:${ncname}\\:)?${ncname})`
const startTagOpen = new RegExp(`^<${qnameCapture}`)
const startTagClose = /^\s*(\/?)>/
const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`)
const doctype = /^<!DOCTYPE [^>]+>/i
// #7298: escape - to avoid being passed as HTML comment when inlined in page
const comment = /^<!\--/
const conditionalComment = /^<!\[/

// Special Elements (can contain anything)
export const isPlainTextElement = makeMap('script,style,textarea', true)
const reCache = {}

const decodingMap = {
  '&lt;': '<',
  '&gt;': '>',
  '&quot;': '"',
  '&amp;': '&',
  '&#10;': '\n',
  '&#9;': '\t',
  '&#39;': "'"
}
const encodedAttr = /&(?:lt|gt|quot|amp|#39);/g
const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g

// #5992
const isIgnoreNewlineTag = makeMap('pre,textarea', true)
const shouldIgnoreFirstNewline = (tag, html) =>
  tag && isIgnoreNewlineTag(tag) && html[0] === '\n'

function decodeAttr(value, shouldDecodeNewlines) {
  const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr
  return value.replace(re, match => decodingMap[match])
}

export interface HTMLParserOptions extends CompilerOptions {
  start?: (
    tag: string,
// ... (282 more lines)

Domain

Subdomains

Dependencies

  • compiler
  • lang
  • util
  • util

Frequently Asked Questions

What does html-parser.ts do?
html-parser.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Observer subdomain.
What functions are defined in html-parser.ts?
html-parser.ts defines 6 function(s): content, decodeAttr, parseHTML, shouldIgnoreFirstNewline, tag, text.
What does html-parser.ts depend on?
html-parser.ts imports 4 module(s): compiler, lang, util, util.
What files import html-parser.ts?
html-parser.ts is imported by 1 file(s): index.ts.
Where is html-parser.ts in the architecture?
html-parser.ts is located at src/compiler/parser/html-parser.ts (domain: VueCore, subdomain: Observer, directory: src/compiler/parser).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free