tidy usage of block.has_content()

pull/4501/head
Conduitry 6 years ago
parent d9388caa03
commit a31253de4e

@ -411,9 +411,8 @@ export default class Block {
return body; return body;
} }
has_content(ignore_dev?: boolean) { has_content() {
return (!ignore_dev && this.renderer.options.dev) || return this.first ||
this.first ||
this.event_listeners.length > 0 || this.event_listeners.length > 0 ||
this.chunks.intro.length > 0 || this.chunks.intro.length > 0 ||
this.chunks.outro.length > 0 || this.chunks.outro.length > 0 ||

@ -264,7 +264,7 @@ export default function dom(
args.push(x`$$props`); args.push(x`$$props`);
} }
const has_create_fragment = block.has_content(); const has_create_fragment = component.compile_options.dev || block.has_content();
if (has_create_fragment) { if (has_create_fragment) {
body.push(b` body.push(b`
function create_fragment(#ctx) { function create_fragment(#ctx) {

@ -154,7 +154,7 @@ export default class InlineComponentWrapper extends Wrapper {
// removing empty slot // removing empty slot
for (const slot of this.slots.keys()) { for (const slot of this.slots.keys()) {
if (!this.slots.get(slot).block.has_content(true)) { if (!this.slots.get(slot).block.has_content()) {
this.slots.delete(slot); this.slots.delete(slot);
} }
} }

Loading…
Cancel
Save