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:
parent
8e96699044
commit
48ce1c9054
@ -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 ) {
|
||||
|
1
test/compiler/component-data-static-boolean/Foo.html
Normal file
1
test/compiler/component-data-static-boolean/Foo.html
Normal file
@ -0,0 +1 @@
|
||||
<p>x: {{x}} ({{typeof x}})</p>
|
3
test/compiler/component-data-static-boolean/_config.js
Normal file
3
test/compiler/component-data-static-boolean/_config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
html: `<p>x: true (boolean)</p>`
|
||||
};
|
9
test/compiler/component-data-static-boolean/main.html
Normal file
9
test/compiler/component-data-static-boolean/main.html
Normal file
@ -0,0 +1,9 @@
|
||||
<Foo x/>
|
||||
|
||||
<script>
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export default {
|
||||
components: { Foo }
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user