0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

fix determing whether an attribute should prevent innerHTML optimization

Fixes #1581
This commit is contained in:
Conduitry 2018-07-08 01:47:38 -04:00
parent 2edc56b919
commit 909536dac9
3 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,5 @@
export default {
html: `
<div><div title='foo'>bar</div></div>
`,
};

View File

@ -0,0 +1 @@
<div><div title={'foo'}>bar</div></div>