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

Function transformStyle

packages/compiler-dom/src/transforms/transformStyle.ts:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15// It is then processed by `transformElement` and included in the generated
16// props.
17export const transformStyle: NodeTransform = node => {
18 if (node.type === NodeTypes.ELEMENT) {
19 node.props.forEach((p, i) => {
20 if (p.type === NodeTypes.ATTRIBUTE && p.name === 'style' && p.value) {
21 // replace p with an expression node
22 node.props[i] = {
23 type: NodeTypes.DIRECTIVE,
24 name: `bind`,
25 arg: createSimpleExpression(`style`, true, p.loc),
26 exp: parseInlineCSS(p.value.content, p.loc),
27 modifiers: [],
28 loc: p.loc,
29 }
30 }
31 })
32 }
33}
34
35const parseInlineCSS = (
36 cssText: string,

Callers

nothing calls this directly

Calls 3

createSimpleExpressionFunction · 0.90
parseInlineCSSFunction · 0.85
forEachMethod · 0.80

Tested by

no test coverage detected