From a5a415cf1d74b01401d3aed3e7b7a6f1afb064a8 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 28 Apr 2018 11:13:25 -0400 Subject: [PATCH] fix indirect dependencies --- src/generators/nodes/Element.ts | 6 +++--- src/generators/nodes/shared/Node.ts | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index 2d0b3e9e4d..dc061d270a 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -150,7 +150,7 @@ export default class Element extends Node { if (select && select.selectBindingDependencies) { select.selectBindingDependencies.forEach(prop => { - dependencies.forEach((dependency: string) => { + attr.dependencies.forEach((dependency: string) => { this.compiler.indirectDependencies.get(prop).add(dependency); }); }); @@ -198,10 +198,10 @@ export default class Element extends Node { // so that if `foo.qux` changes, we know that we need to // mark `bar` and `baz` as dirty too if (this.name === 'select') { - const binding = this.attributes.find(node => node.type === 'Binding' && node.name === 'value'); + const binding = this.bindings.find(node => node.name === 'value'); if (binding) { // TODO does this also apply to e.g. ``? - const dependencies = binding.expression.dependencies; + const dependencies = binding.value.dependencies; this.selectBindingDependencies = dependencies; dependencies.forEach((prop: string) => { this.compiler.indirectDependencies.set(prop, new Set()); diff --git a/src/generators/nodes/shared/Node.ts b/src/generators/nodes/shared/Node.ts index b66220372d..cb040f3dd0 100644 --- a/src/generators/nodes/shared/Node.ts +++ b/src/generators/nodes/shared/Node.ts @@ -36,10 +36,7 @@ export default class Node { cannotUseInnerHTML() { if (this.canUseInnerHTML !== false) { this.canUseInnerHTML = false; - if (this.parent) { - if (!this.parent.cannotUseInnerHTML) console.log(this.parent.type, this.type); - this.parent.cannotUseInnerHTML(); - } + if (this.parent) this.parent.cannotUseInnerHTML(); } }