Home / File/ dom-props.ts — vue Source File

dom-props.ts — vue Source File

Architecture documentation for dom-props.ts, a typescript file in the vue codebase. 3 imports, 1 dependents.

File typescript WebPlatform RuntimeModules 3 imports 1 dependents 4 functions

Entity Profile

Dependency Diagram

graph LR
  297f96f5_ce18_dfbe_5031_c5fe5e97a7a4["dom-props.ts"]
  156bf2e1_8a13_f22d_5437_54f14bcef8fa["util"]
  297f96f5_ce18_dfbe_5031_c5fe5e97a7a4 --> 156bf2e1_8a13_f22d_5437_54f14bcef8fa
  81ed4f13_7d68_6e21_7425_cf978f68576f["vnode"]
  297f96f5_ce18_dfbe_5031_c5fe5e97a7a4 --> 81ed4f13_7d68_6e21_7425_cf978f68576f
  148abdbd_b24a_66f6_25f5_6786df341ad2["index"]
  297f96f5_ce18_dfbe_5031_c5fe5e97a7a4 --> 148abdbd_b24a_66f6_25f5_6786df341ad2
  227f73c4_4e20_2188_e5c5_a61fcdcc0b12["index.ts"]
  227f73c4_4e20_2188_e5c5_a61fcdcc0b12 --> 297f96f5_ce18_dfbe_5031_c5fe5e97a7a4
  style 297f96f5_ce18_dfbe_5031_c5fe5e97a7a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isDef, isUndef, extend, toNumber, isTrue } from 'shared/util'
import type { VNodeWithData } from 'types/vnode'
import { isSVG } from 'web/util/index'

let svgContainer

function updateDOMProps(oldVnode: VNodeWithData, vnode: VNodeWithData) {
  if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
    return
  }
  let key, cur
  const elm: any = vnode.elm
  const oldProps = oldVnode.data.domProps || {}
  let props = vnode.data.domProps || {}
  // clone observed objects, as the user probably wants to mutate it
  if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
    props = vnode.data.domProps = extend({}, props)
  }

  for (key in oldProps) {
    if (!(key in props)) {
      elm[key] = ''
    }
  }

  for (key in props) {
    cur = props[key]
    // ignore children if the node has textContent or innerHTML,
    // as these will throw away existing DOM nodes and cause removal errors
    // on subsequent patches (#3360)
    if (key === 'textContent' || key === 'innerHTML') {
      if (vnode.children) vnode.children.length = 0
      if (cur === oldProps[key]) continue
      // #6601 work around Chrome version <= 55 bug where single textNode
      // replaced by innerHTML/textContent retains its parentNode property
      if (elm.childNodes.length === 1) {
        elm.removeChild(elm.childNodes[0])
      }
    }

    if (key === 'value' && elm.tagName !== 'PROGRESS') {
      // store value as _value as well since
      // non-string values will be stringified
      elm._value = cur
      // avoid resetting cursor position when value is the same
      const strCur = isUndef(cur) ? '' : String(cur)
      if (shouldUpdateValue(elm, strCur)) {
        elm.value = strCur
      }
    } else if (
      key === 'innerHTML' &&
      isSVG(elm.tagName) &&
      isUndef(elm.innerHTML)
    ) {
      // IE doesn't support innerHTML for SVG elements
      svgContainer = svgContainer || document.createElement('div')
      svgContainer.innerHTML = `<svg>${cur}</svg>`
      const svg = svgContainer.firstChild
      while (elm.firstChild) {
        elm.removeChild(elm.firstChild)
// ... (64 more lines)

Domain

Subdomains

Dependencies

  • index
  • util
  • vnode

Frequently Asked Questions

What does dom-props.ts do?
dom-props.ts is a source file in the vue codebase, written in typescript. It belongs to the WebPlatform domain, RuntimeModules subdomain.
What functions are defined in dom-props.ts?
dom-props.ts defines 4 function(s): isDirtyWithModifiers, isNotInFocusAndDirty, shouldUpdateValue, updateDOMProps.
What does dom-props.ts depend on?
dom-props.ts imports 3 module(s): index, util, vnode.
What files import dom-props.ts?
dom-props.ts is imported by 1 file(s): index.ts.
Where is dom-props.ts in the architecture?
dom-props.ts is located at src/platforms/web/runtime/modules/dom-props.ts (domain: WebPlatform, subdomain: RuntimeModules, directory: src/platforms/web/runtime/modules).

Analyze Your Own Codebase

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

Try Supermodel Free