merge master -> set-undefined-attr

pull/1815/head
Rich Harris 6 years ago
commit 8642ef17a4

@ -82,7 +82,8 @@ export function removeListener(node, event, handler) {
} }
export function setAttribute(node, attribute, value) { export function setAttribute(node, attribute, value) {
node.setAttribute(attribute, value); if (value == null) removeAttribute(node, attribute);
else node.setAttribute(attribute, value);
} }
export function setAttributes(node, attributes) { export function setAttributes(node, attributes) {
@ -92,8 +93,7 @@ export function setAttributes(node, attributes) {
} else if (key in node) { } else if (key in node) {
node[key] = attributes[key]; node[key] = attributes[key];
} else { } else {
if (attributes[key] === undefined) removeAttribute(node, key); setAttribute(node, key, attributes[key]);
else setAttribute(node, key, attributes[key]);
} }
} }
} }

@ -0,0 +1,5 @@
export default {
'skip-ssr': true,
html: '<div></div>'
};

@ -0,0 +1,14 @@
<div {foo} {bar}></div>
<script>
export default {
data: () => ({
foo: 1,
bar: undefined
}),
oncreate () {
this.set({ foo: undefined });
}
};
</script>
Loading…
Cancel
Save