more fixes. almost there

pull/1746/head
Rich Harris 7 years ago
parent 84b5345aee
commit 81bf0fd4ad

@ -9,13 +9,15 @@ export default class AttributeWrapper {
node: Attribute;
parent: ElementWrapper;
constructor(node: Attribute, parent: ElementWrapper) {
constructor(parent: ElementWrapper, block: Block, node: Attribute) {
this.node = node;
this.parent = parent;
if (node.dependencies.size > 0) {
parent.cannotUseInnerHTML();
block.addDependencies(node.dependencies);
// special case — <option value={foo}> — see below
if (this.parent.node.name === 'option' && node.name === 'value') {
let select: ElementWrapper = this.parent;

@ -130,9 +130,9 @@ export default class ElementWrapper extends Wrapper {
owner._slots.add(attribute.getStaticValue());
}
if (attribute.name === 'style') {
return new StyleAttributeWrapper(attribute, this);
return new StyleAttributeWrapper(this, block, attribute);
}
return new AttributeWrapper(attribute, this);
return new AttributeWrapper(this, block, attribute);
});
let has_bindings;
@ -166,6 +166,11 @@ export default class ElementWrapper extends Wrapper {
if (node.animation) {
block.addAnimation();
this.cannotUseInnerHTML();
}
if (node.ref) {
this.cannotUseInnerHTML();
}
this.fragment = new FragmentWrapper(renderer, block, node.children, this, stripWhitespace, nextSibling);

@ -221,6 +221,7 @@ export default class IfBlockWrapper extends Wrapper {
${this.branches
.map(({ condition, block }) => `${condition ? `if (${condition}) ` : ''}return ${block.name};`)
.join('\n')}
${!hasElse && `return -1;`}
}
`);
@ -298,6 +299,7 @@ export default class IfBlockWrapper extends Wrapper {
${this.branches
.map(({ condition, block }, i) => `${condition ? `if (${condition}) ` : ''}return ${block ? i : -1};`)
.join('\n')}
${!hasElse && `return -1;`}
}
`);

Loading…
Cancel
Save