|
|
|
|
@ -169,8 +169,17 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
|
next_sibling: Wrapper
|
|
|
|
|
) {
|
|
|
|
|
super(renderer, block, parent, node);
|
|
|
|
|
const is_original_dynamic_element = node.is_dynamic_element && block.type !== CHILD_DYNAMIC_ELEMENT_BLOCK;
|
|
|
|
|
if (is_original_dynamic_element) {
|
|
|
|
|
|
|
|
|
|
this.var = {
|
|
|
|
|
type: 'Identifier',
|
|
|
|
|
name: node.name.replace(regex_invalid_variable_identifier_characters, '_')
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.void = is_void(node.name);
|
|
|
|
|
|
|
|
|
|
this.class_dependencies = [];
|
|
|
|
|
|
|
|
|
|
if (node.is_dynamic_element && block.type !== CHILD_DYNAMIC_ELEMENT_BLOCK) {
|
|
|
|
|
this.child_dynamic_element_block = block.child({
|
|
|
|
|
comment: create_debugging_comment(node, renderer.component),
|
|
|
|
|
name: renderer.component.get_unique_name('create_dynamic_element'),
|
|
|
|
|
@ -185,22 +194,14 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
|
strip_whitespace,
|
|
|
|
|
next_sibling
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.var = {
|
|
|
|
|
type: 'Identifier',
|
|
|
|
|
name: node.name.replace(regex_invalid_variable_identifier_characters, '_')
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.void = is_void(node.name);
|
|
|
|
|
|
|
|
|
|
this.class_dependencies = [];
|
|
|
|
|
|
|
|
|
|
// the original svelte:element is never used for rendering, because
|
|
|
|
|
// it gets assigned a child_dynamic_element which is used in all rendering logic.
|
|
|
|
|
// so doing all of this on the original svelte:element will just cause double
|
|
|
|
|
// code, because it will be done again on the child_dynamic_element.
|
|
|
|
|
if (!is_original_dynamic_element) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.node.children.length) {
|
|
|
|
|
this.node.lets.forEach(l => {
|
|
|
|
|
extract_names(l.value || l.name).forEach(name => {
|
|
|
|
|
@ -269,7 +270,6 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
|
|
|
|
|
|
this.fragment = new FragmentWrapper(renderer, block, node.children, this, strip_whitespace, next_sibling);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(block: Block, parent_node: Identifier, parent_nodes: Identifier) {
|
|
|
|
|
if (this.child_dynamic_element) {
|
|
|
|
|
@ -332,8 +332,7 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
|
${this.var}.p(#ctx, #dirty);
|
|
|
|
|
}
|
|
|
|
|
} else if (${previous_tag}) {
|
|
|
|
|
${
|
|
|
|
|
has_transitions
|
|
|
|
|
${has_transitions
|
|
|
|
|
? b`
|
|
|
|
|
@group_outros();
|
|
|
|
|
@transition_out(${this.var}, 1, 1, () => {
|
|
|
|
|
|