dom-props.ts — vue Source File
Architecture documentation for dom-props.ts, a typescript file in the vue codebase. 3 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 499981ef_61ac_579c_c134_3ae2dc9cdf2c["dom-props.ts"] 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] 499981ef_61ac_579c_c134_3ae2dc9cdf2c --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"] 499981ef_61ac_579c_c134_3ae2dc9cdf2c --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1 28507de2_df66_4d38_8b45_3af459d16f77["index"] 499981ef_61ac_579c_c134_3ae2dc9cdf2c --> 28507de2_df66_4d38_8b45_3af459d16f77 7973a695_d0db_6940_134b_f6ff953b9e97["index.ts"] 7973a695_d0db_6940_134b_f6ff953b9e97 --> 499981ef_61ac_579c_c134_3ae2dc9cdf2c style 499981ef_61ac_579c_c134_3ae2dc9cdf2c 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
Types
Dependencies
- index
- util
- vnode
Imported By
Source
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, WebRuntime 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: WebRuntime, 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