Fix partial numbers being detected as numbers

pull/235/head
Paul Sauve 8 years ago
parent f8701545e9
commit ca2f0a5bbb

@ -28,7 +28,7 @@ export default function addComponentAttributes ( generator, node, local ) {
if ( value.type === 'Text' ) { if ( value.type === 'Text' ) {
// static attributes // static attributes
const result = isNaN( parseFloat( value.data ) ) ? JSON.stringify( value.data ) : value.data; const result = String( parseFloat( value.data ) ) !== value.data ? JSON.stringify( value.data ) : value.data;
local.staticAttributes.push({ local.staticAttributes.push({
name: attribute.name, name: attribute.name,
value: result value: result

@ -0,0 +1,3 @@
export default {
html: '<p data-value="10px"></p>'
};

@ -0,0 +1,11 @@
<Component value="10px"/>
<script>
import Component from './Component.html';
export default {
components: {
Component
}
};
</script>
Loading…
Cancel
Save