fix(HtmlParser): Do not add parent element for template children
fixes #5638
This commit is contained in:
parent
9850e68703
commit
3a438615c3
@ -304,8 +304,16 @@ export class HtmlTagDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
requireExtraParent(currentParent: string): boolean {
|
requireExtraParent(currentParent: string): boolean {
|
||||||
return isPresent(this.requiredParents) &&
|
if (isBlank(this.requiredParents)) {
|
||||||
(isBlank(currentParent) || this.requiredParents[currentParent.toLowerCase()] != true);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlank(currentParent)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let lcParent = currentParent.toLowerCase();
|
||||||
|
return this.requiredParents[lcParent] != true && lcParent != 'template';
|
||||||
}
|
}
|
||||||
|
|
||||||
isClosedByChild(name: string): boolean {
|
isClosedByChild(name: string): boolean {
|
||||||
|
@ -141,6 +141,14 @@ export function main() {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not add the requiredParent when the parent is a template', () => {
|
||||||
|
expect(humanizeDom(parser.parse('<template><tr></tr></template>', 'TestComp')))
|
||||||
|
.toEqual([
|
||||||
|
[HtmlElementAst, 'template', 0],
|
||||||
|
[HtmlElementAst, 'tr', 1],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('should support explicit mamespace', () => {
|
it('should support explicit mamespace', () => {
|
||||||
expect(humanizeDom(parser.parse('<myns:div></myns:div>', 'TestComp')))
|
expect(humanizeDom(parser.parse('<myns:div></myns:div>', 'TestComp')))
|
||||||
.toEqual([[HtmlElementAst, '@myns:div', 0]]);
|
.toEqual([[HtmlElementAst, '@myns:div', 0]]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user