Skip to content

Commit

Permalink
fix determing whether an attribute should prevent innerHTML optimization
Browse files Browse the repository at this point in the history
Fixes #1581
  • Loading branch information
Conduitry committed Jul 8, 2018
1 parent 2edc56b commit 909536d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/compile/nodes/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 — <option value={foo}> — see below
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
html: `
<div><div title='foo'>bar</div></div>
`,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div><div title={'foo'}>bar</div></div>

0 comments on commit 909536d

Please sign in to comment.