tidy up, prevent collisions

pull/2996/head
Richard Harris 6 years ago
parent e3de705cb8
commit 4f626c45a9

@ -156,23 +156,18 @@ export default function(node: Element, renderer: Renderer, options: RenderOption
// TODO server-render group bindings
} else if (contenteditable && (name === 'text' || name === 'html')) {
node_contents = snip(expression);
if (name == 'text') {
value = '@escape($$value)';
} else {
// Do not escape HTML content
value = '$$value';
}
value = name === 'text' ? '@escape($$value)' : '$$value';
} else if (binding.name === 'value' && node.name === 'textarea') {
const snippet = snip(expression);
node_contents = '${(' + snippet + ') || ""}';
} else {
const snippet = snip(expression);
opening_tag += ' ${(v => v ? ("' + name + '" + (v === true ? "" : "=" + JSON.stringify(v))) : "")(' + snippet + ')}';
opening_tag += ' ${($$value => $$value ? ("' + name + '" + ($$value === true ? "" : "=" + JSON.stringify($$value))) : "")(' + snippet + ')}';
}
});
if (add_class_attribute) {
opening_tag += `\${((v) => v ? ' class="' + v + '"' : '')([${class_expression}].join(' ').trim())}`;
opening_tag += `\${(($$value) => $$value ? ' class="' + $$value + '"' : '')([${class_expression}].join(' ').trim())}`;
}
opening_tag += '>';

@ -118,4 +118,4 @@ export function get_store_value<T>(store: Readable<T>): T | undefined {
let value;
store.subscribe(_ => value = _)();
return value;
}
}
Loading…
Cancel
Save