mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] portal: portal as a Directive
Before this commit, portal was a Component, now is a directive. This commit also clean some unused code, and fix an issue on the clean optimization when a portal is found in a condition or a loop.
This commit is contained in:
committed by
Aaron Bohy
parent
c221721d7f
commit
90167c5436
@@ -15,9 +15,11 @@ export class VMulti {
|
||||
anchors?: Node[] | undefined;
|
||||
parentEl?: HTMLElement | undefined;
|
||||
isOnlyChild?: boolean | undefined;
|
||||
deepRemove: boolean;
|
||||
|
||||
constructor(children: (VNode | undefined)[]) {
|
||||
constructor(children: (VNode | undefined)[], deepRemove: boolean) {
|
||||
this.children = children;
|
||||
this.deepRemove = deepRemove;
|
||||
}
|
||||
|
||||
mount(parent: HTMLElement, afterNode: Node | null) {
|
||||
@@ -103,7 +105,7 @@ export class VMulti {
|
||||
|
||||
remove() {
|
||||
const parentEl = this.parentEl;
|
||||
if (this.isOnlyChild) {
|
||||
if (this.isOnlyChild && !this.deepRemove) {
|
||||
nodeSetTextContent.call(parentEl, "");
|
||||
} else {
|
||||
const children = this.children;
|
||||
@@ -129,6 +131,6 @@ export class VMulti {
|
||||
}
|
||||
}
|
||||
|
||||
export function multi(children: (VNode | undefined)[]): VNode<VMulti> {
|
||||
return new VMulti(children);
|
||||
export function multi(children: (VNode | undefined)[], deepRemove = false): VNode<VMulti> {
|
||||
return new VMulti(children, deepRemove);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user