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 // TODO server-render group bindings
} else if (contenteditable && (name === 'text' || name === 'html')) { } else if (contenteditable && (name === 'text' || name === 'html')) {
node_contents = snip(expression); node_contents = snip(expression);
if (name == 'text') { value = name === 'text' ? '@escape($$value)' : '$$value';
value = '@escape($$value)';
} else {
// Do not escape HTML content
value = '$$value';
}
} else if (binding.name === 'value' && node.name === 'textarea') { } else if (binding.name === 'value' && node.name === 'textarea') {
const snippet = snip(expression); const snippet = snip(expression);
node_contents = '${(' + snippet + ') || ""}'; node_contents = '${(' + snippet + ') || ""}';
} else { } else {
const snippet = snip(expression); 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) { 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 += '>'; opening_tag += '>';

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