preTransformNode() — vue Function Reference
Architecture documentation for the preTransformNode() function in model.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 5266d1ae_e943_1c9a_9925_9c539b8a7a9b["preTransformNode()"] 2e03f8d2_4a5a_f1cd_1d7b_db95ba63549e["getBindingAttr()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| 2e03f8d2_4a5a_f1cd_1d7b_db95ba63549e b54f5bfb_1a4e_430d_f7d5_41f81c9a1ab3["getAndRemoveAttr()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| b54f5bfb_1a4e_430d_f7d5_41f81c9a1ab3 460171af_a744_8c20_a53f_2f1aedb3bc7b["cloneASTElement()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| 460171af_a744_8c20_a53f_2f1aedb3bc7b 327c11d5_a4b9_58c5_30dd_58c353557eea["processFor()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| 327c11d5_a4b9_58c5_30dd_58c353557eea d7971411_6ab9_282d_5d39_b2b512670520["addRawAttr()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| d7971411_6ab9_282d_5d39_b2b512670520 31f9edc3_10e5_9556_86c6_7c900b922f60["processElement()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| 31f9edc3_10e5_9556_86c6_7c900b922f60 a43ff6ef_b3eb_ea6c_cf0e_7fea2e444821["addIfCondition()"] 5266d1ae_e943_1c9a_9925_9c539b8a7a9b -->|calls| a43ff6ef_b3eb_ea6c_cf0e_7fea2e444821 style 5266d1ae_e943_1c9a_9925_9c539b8a7a9b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/platforms/web/compiler/modules/model.ts lines 21–81
function preTransformNode(el: ASTElement, options: CompilerOptions) {
if (el.tag === 'input') {
const map = el.attrsMap
if (!map['v-model']) {
return
}
let typeBinding
if (map[':type'] || map['v-bind:type']) {
typeBinding = getBindingAttr(el, 'type')
}
if (!map.type && !typeBinding && map['v-bind']) {
typeBinding = `(${map['v-bind']}).type`
}
if (typeBinding) {
const ifCondition = getAndRemoveAttr(el, 'v-if', true)
const ifConditionExtra = ifCondition ? `&&(${ifCondition})` : ``
const hasElse = getAndRemoveAttr(el, 'v-else', true) != null
const elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true)
// 1. checkbox
const branch0 = cloneASTElement(el)
// process for on the main node
processFor(branch0)
addRawAttr(branch0, 'type', 'checkbox')
processElement(branch0, options)
branch0.processed = true // prevent it from double-processed
branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra
addIfCondition(branch0, {
exp: branch0.if,
block: branch0
})
// 2. add radio else-if condition
const branch1 = cloneASTElement(el)
getAndRemoveAttr(branch1, 'v-for', true)
addRawAttr(branch1, 'type', 'radio')
processElement(branch1, options)
addIfCondition(branch0, {
exp: `(${typeBinding})==='radio'` + ifConditionExtra,
block: branch1
})
// 3. other
const branch2 = cloneASTElement(el)
getAndRemoveAttr(branch2, 'v-for', true)
addRawAttr(branch2, ':type', typeBinding)
processElement(branch2, options)
addIfCondition(branch0, {
exp: ifCondition!,
block: branch2
})
if (hasElse) {
branch0.else = true
} else if (elseIfCondition) {
branch0.elseif = elseIfCondition
}
return branch0
}
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does preTransformNode() do?
preTransformNode() is a function in the vue codebase.
What does preTransformNode() call?
preTransformNode() calls 7 function(s): addIfCondition, addRawAttr, cloneASTElement, getAndRemoveAttr, getBindingAttr, processElement, processFor.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free