MCPcopy
hub / github.com/vuejs/core / processOption

Function processOption

packages/compiler-ssr/src/transforms/ssrVModel.ts:54–82  ·  view source on GitHub ↗
(plainNode: PlainElementNode)

Source from the content-addressed store, hash-verified

52 }
53
54 function processOption(plainNode: PlainElementNode) {
55 if (plainNode.tag === 'option') {
56 if (plainNode.props.findIndex(p => p.name === 'selected') === -1) {
57 const value = findValueBinding(plainNode)
58 plainNode.ssrCodegenNode!.elements.push(
59 createConditionalExpression(
60 createCallExpression(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [
61 createConditionalExpression(
62 createCallExpression(`Array.isArray`, [model]),
63 createCallExpression(context.helper(SSR_LOOSE_CONTAIN), [
64 model,
65 value,
66 ]),
67 createCallExpression(context.helper(SSR_LOOSE_EQUAL), [
68 model,
69 value,
70 ]),
71 ),
72 ]),
73 createSimpleExpression(' selected', true),
74 createSimpleExpression('', true),
75 false /* no newline */,
76 ),
77 )
78 }
79 } else if (plainNode.tag === 'optgroup') {
80 processSelectChildren(plainNode.children)
81 }
82 }
83
84 if (node.tagType === ElementTypes.ELEMENT) {
85 const res: DirectiveTransformResult = { props: [] }

Callers 1

processSelectChildrenFunction · 0.85

Calls 8

findValueBindingFunction · 0.85
createCallExpressionFunction · 0.85
createSimpleExpressionFunction · 0.85
processSelectChildrenFunction · 0.85
findIndexMethod · 0.80
pushMethod · 0.65
helperMethod · 0.65

Tested by

no test coverage detected