Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
container: HostElement,
anchor: HostNode | null,
parentComponent: ComponentInternalInstance | null,
parentSuspense: HostSuspenseBoundary | null,
isSVG: boolean,
optimized: boolean
) {
const tag = vnode.type as string
isSVG = isSVG || tag === 'svg'
const el = (vnode.el = hostCreateElement(tag, isSVG))
const { props, shapeFlag, transition, scopeId } = vnode
// props
if (props != null) {
for (const key in props) {
if (isReservedProp(key)) continue
hostPatchProp(el, key, props[key], null, isSVG)
}
if (props.onVnodeBeforeMount != null) {
invokeDirectiveHook(props.onVnodeBeforeMount, parentComponent, vnode)
}
}
// scopeId
if (__BUNDLER__) {
if (scopeId !== null) {
hostSetScopeId(el, scopeId)
}
const treeOwnerId = parentComponent && parentComponent.type.__scopeId
// vnode's own scopeId and the current patched component's scopeId is
// different - this is a slot content node.
if (treeOwnerId != null && treeOwnerId !== scopeId) {
hostPatchProp(
el,
key,
next,
prev,
isSVG,
vnode.children as HostVNode[],
parentComponent,
parentSuspense,
unmountChildren
)
}
}
if (oldProps !== EMPTY_OBJ) {
for (const key in oldProps) {
if (!isReservedProp(key) && !(key in newProps)) {
hostPatchProp(
el,
key,
null,
null,
isSVG,
vnode.children as HostVNode[],
parentComponent,
parentSuspense,
unmountChildren
)
}
}
}
}
}
function patchProps(
el: HostElement,
vnode: HostVNode,
oldProps: Data,
newProps: Data,
parentComponent: ComponentInternalInstance | null,
parentSuspense: HostSuspenseBoundary | null,
isSVG: boolean
) {
if (oldProps !== newProps) {
for (const key in newProps) {
if (isReservedProp(key)) continue
const next = newProps[key]
const prev = oldProps[key]
if (next !== prev) {
hostPatchProp(
el,
key,
next,
prev,
isSVG,
vnode.children as HostVNode[],
parentComponent,
parentSuspense,
unmountChildren
)
}
}