refactor: tidy up compile/render_dom

pull/8077/head
Simon He 4 years ago
parent e44762aa2d
commit 3bf08f4296

@ -221,10 +221,8 @@ export default class ElementWrapper extends Wrapper {
this.event_handlers = this.node.handlers.map(event_handler => new EventHandler(event_handler, this)); this.event_handlers = this.node.handlers.map(event_handler => new EventHandler(event_handler, this));
if (node.intro || node.outro) {
if (node.intro) block.add_intro(node.intro.is_local); if (node.intro) block.add_intro(node.intro.is_local);
if (node.outro) block.add_outro(node.outro.is_local); if (node.outro) block.add_outro(node.outro.is_local);
}
if (node.animation) { if (node.animation) {
block.add_animation(); block.add_animation();
@ -326,8 +324,7 @@ export default class ElementWrapper extends Wrapper {
${this.var}.p(#ctx, #dirty); ${this.var}.p(#ctx, #dirty);
} }
} else if (${previous_tag}) { } else if (${previous_tag}) {
${ ${has_transitions
has_transitions
? b` ? b`
@group_outros(); @group_outros();
@transition_out(${this.var}, 1, 1, () => { @transition_out(${this.var}, 1, 1, () => {

@ -2,11 +2,8 @@ import { Var } from '../../../../interfaces';
import { is_reserved_keyword } from '../../../utils/reserved_keywords'; import { is_reserved_keyword } from '../../../utils/reserved_keywords';
export default function is_dynamic(variable: Var) { export default function is_dynamic(variable: Var) {
if (variable) { if (!variable) return false;
if (variable.mutated || variable.reassigned) return true; // dynamic internal state if (variable.mutated || variable.reassigned) return true; // dynamic internal state
if (!variable.module && variable.writable && variable.export_name) return true; // writable props if (!variable.module && variable.writable && variable.export_name) return true; // writable props
if (is_reserved_keyword(variable.name)) return true; if (is_reserved_keyword(variable.name)) return true;
}
return false;
} }

Loading…
Cancel
Save