mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 02:57:43 +08:00
refactor(compiler): move postTransforms to after children are processed
This commit is contained in:
parent
996eb00a0a
commit
248803146c
@ -37,9 +37,12 @@ declare type CompiledResult = {
|
||||
};
|
||||
|
||||
declare type ModuleOptions = {
|
||||
// transform an AST node before any attributes are processed
|
||||
// returning an ASTElement from pre/transforms replaces the element
|
||||
preTransformNode: (el: ASTElement) => ?ASTElement;
|
||||
// transform an AST node after built-ins like v-if, v-for are processed
|
||||
transformNode: (el: ASTElement) => ?ASTElement;
|
||||
// transform an AST node after its children have been processed
|
||||
// cannot return replacement in postTransform because tree is already finalized
|
||||
postTransformNode: (el: ASTElement) => void;
|
||||
genData: (el: ASTElement) => string; // generate extra data string for an element
|
||||
|
@ -221,10 +221,6 @@ export function parse (
|
||||
} else {
|
||||
endPre(element)
|
||||
}
|
||||
// apply post-transforms
|
||||
for (let i = 0; i < postTransforms.length; i++) {
|
||||
postTransforms[i](element, options)
|
||||
}
|
||||
},
|
||||
|
||||
end () {
|
||||
@ -238,6 +234,11 @@ export function parse (
|
||||
stack.length -= 1
|
||||
currentParent = stack[stack.length - 1]
|
||||
endPre(element)
|
||||
|
||||
// apply post-transforms
|
||||
for (let i = 0; i < postTransforms.length; i++) {
|
||||
postTransforms[i](element, options)
|
||||
}
|
||||
},
|
||||
|
||||
chars (text: string) {
|
||||
|
Loading…
Reference in New Issue
Block a user