-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(renderer): set templateParent to comment and text nodes (#785)
* fix(renderer): set templateParent for newly create DetachedText nodes DetachedText is not inserted in the UI components tree, so we need to add it's parent manually. * fix(renderer): respect templateParent in parentNode() if one is set fixes #777, fixes #787 * test: add unit test for NgIfElse and NgIfThenElse * chore: target 'next' tag of tns-core-modules * fix(renderer): stop attaching comments to visual tree * refactor(renderer): create DetachedElements instead for comments and text nodes * refactor: move NgView, NgElement and similar to separate module
- Loading branch information
Showing
17 changed files
with
280 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { View } from "tns-core-modules/ui/core/view"; | ||
|
||
export type NgView = (View & ViewExtensions); | ||
export type NgElement = NgView | CommentNode; | ||
|
||
export interface ViewExtensions { | ||
nodeType: number; | ||
nodeName: string; | ||
templateParent: NgView; | ||
ngCssClasses: Map<string, boolean>; | ||
meta: ViewClassMeta; | ||
} | ||
|
||
export interface ViewClass { | ||
new (): View; | ||
} | ||
|
||
// used for creating comments and text nodes in the renderer | ||
export class CommentNode { | ||
meta: { skipAddToDom: true }; | ||
templateParent: NgView; | ||
} | ||
|
||
export interface ViewClassMeta { | ||
skipAddToDom?: boolean; | ||
insertChild?: (parent: NgView, child: NgView, atIndex: number) => void; | ||
removeChild?: (parent: NgView, child: NgView) => void; | ||
} | ||
|
||
export function isDetachedElement(element): boolean { | ||
return (element && element.meta && element.meta.skipAddToDom); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.