diff --git a/packages/compiler-core/src/options.ts b/packages/compiler-core/src/options.ts index 2e08cdae..8dca9210 100644 --- a/packages/compiler-core/src/options.ts +++ b/packages/compiler-core/src/options.ts @@ -10,7 +10,11 @@ export interface ParserOptions { isCustomElement?: (tag: string) => boolean isBuiltInComponent?: (tag: string) => symbol | void getNamespace?: (tag: string, parent: ElementNode | undefined) => Namespace - getTextMode?: (tag: string, ns: Namespace) => TextModes + getTextMode?: ( + tag: string, + ns: Namespace, + parent: ElementNode | undefined + ) => TextModes delimiters?: [string, string] // ['{{', '}}'] // Map to HTML entities. E.g., `{ "amp;": "&" }` diff --git a/packages/compiler-core/src/parse.ts b/packages/compiler-core/src/parse.ts index b9b37953..9c3299a3 100644 --- a/packages/compiler-core/src/parse.ts +++ b/packages/compiler-core/src/parse.ts @@ -365,7 +365,7 @@ function parseElement( // Children. ancestors.push(element) - const mode = context.options.getTextMode(element.tag, element.ns) + const mode = context.options.getTextMode(element.tag, element.ns, parent) const children = parseChildren(context, mode, ancestors) ancestors.pop() diff --git a/packages/compiler-sfc/__tests__/parse.spec.ts b/packages/compiler-sfc/__tests__/parse.spec.ts index 6a4534c1..affe1f5a 100644 --- a/packages/compiler-sfc/__tests__/parse.spec.ts +++ b/packages/compiler-sfc/__tests__/parse.spec.ts @@ -78,8 +78,8 @@ h1 { color: red } ok