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

fix component boolean attributes

This commit is contained in:
Rich-Harris 2016-11-22 17:45:51 -05:00
parent 8e96699044
commit 48ce1c9054
4 changed files with 14 additions and 1 deletions

View File

@ -9,7 +9,7 @@ export default function addComponentAttributes ( generator, node, local ) {
if ( attribute.type === 'Attribute' ) {
if ( attribute.value === true ) {
// attributes without values, e.g. <textarea readonly>
local.data.push( `${attribute.name}: true` );
local.staticAttributes.push( `${attribute.name}: true` );
}
else if ( attribute.value.length === 1 ) {

View File

@ -0,0 +1 @@
<p>x: {{x}} ({{typeof x}})</p>

View File

@ -0,0 +1,3 @@
export default {
html: `<p>x: true (boolean)</p>`
};

View File

@ -0,0 +1,9 @@
<Foo x/>
<script>
import Foo from './Foo.html';
export default {
components: { Foo }
};
</script>