Skip to content

Commit

Permalink
Rename dynamic_name to dynamic_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred Ringstad committed Oct 1, 2020
1 parent 6c81c84 commit e6d3f1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/compiler/compile/nodes/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default class Element extends Node {
children: INode[];
namespace: string;
needs_manual_style_scoping: boolean;
dynamic_name?: Expression;
dynamic_tag?: Expression;

constructor(component: Component, parent, scope, info: any) {
super(component, parent, scope, info);
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/compile/render_dom/wrappers/DynamicElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export default class DynamicElementWrapper extends Wrapper {
type: "dynamic_element",
});
renderer.blocks.push(block);
(node as any).dynamic_name = node.tag;
(node as any).dynamic_tag = node.tag;
} else {
if (typeof node.tag.node === 'string') {
node.name = node.tag.node;
} else {
// tag has no dependencies but is not an explicit string
(node as any).dynamic_name = node.tag;
(node as any).dynamic_tag = node.tag;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/compiler/compile/render_dom/wrappers/Element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ export default class ElementWrapper extends Wrapper {
return x`@element_is("${name}", ${is.render_chunks(block).reduce((lhs, rhs) => x`${lhs} + ${rhs}`)})`;
}

if (this.node.dynamic_name) {
const reference = this.renderer.reference(this.node.dynamic_name.node);
if (this.node.dynamic_tag) {
const reference = this.renderer.reference(this.node.dynamic_tag.node);
return x`@element(${reference})`;
}

Expand All @@ -404,8 +404,8 @@ export default class ElementWrapper extends Wrapper {

const svg = this.node.namespace === namespaces.svg ? 1 : null;

if (this.node.dynamic_name) {
const reference = this.renderer.reference(this.node.dynamic_name.node);
if (this.node.dynamic_tag) {
const reference = this.renderer.reference(this.node.dynamic_tag.node);
return x`@claim_element(${nodes}, ${reference}, { ${attributes} }, ${svg})`;
}

Expand Down

0 comments on commit e6d3f1a

Please sign in to comment.