From d0f8a37424820f3dbe507a6470d9c42a01a5e059 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 6 Jul 2018 09:25:38 -0400 Subject: [PATCH 1/3] :us: --- src/cli/error.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/error.ts b/src/cli/error.ts index b7ca813716..cfe6a3e72d 100644 --- a/src/cli/error.ts +++ b/src/cli/error.ts @@ -8,9 +8,9 @@ export default function error(err) { stderr(`${clorox.red(err.message || err)}`); if (err.frame) { - stderr(err.frame); // eslint-disable-line no-console + stderr(err.frame); } else if (err.stack) { - stderr(`${clorox.grey(err.stack)}`); + stderr(`${clorox.gray(err.stack)}`); } process.exit(1); From 8e95c29a771f5d1a0c2ab7981eb185a6c874bc09 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 8 Jul 2018 01:47:38 -0400 Subject: [PATCH 2/3] fix determing whether an attribute should prevent innerHTML optimization Fixes #1581 --- src/compile/nodes/Element.ts | 8 +++++++- .../samples/attribute-dynamic-no-dependencies/_config.js | 5 +++++ .../samples/attribute-dynamic-no-dependencies/main.html | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/attribute-dynamic-no-dependencies/_config.js create mode 100644 test/runtime/samples/attribute-dynamic-no-dependencies/main.html diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index a2a6f8d5b4..403b9cce8b 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -152,8 +152,14 @@ export default class Element extends Node { ); this.attributes.forEach(attr => { - if (attr.dependencies.size) { + if ( + attr.chunks && + attr.chunks.length && + (attr.chunks.length > 1 || attr.chunks[0].type !== 'Text') + ) { this.parent.cannotUseInnerHTML(); + } + if (attr.dependencies.size) { block.addDependencies(attr.dependencies); // special case —