webtides / element-js

Simple and lightweight base classes for web components with a beautiful API
MIT License
28 stars 3 forks source link

property assignment number conversion #80

Open quarkus opened 1 year ago

quarkus commented 1 year ago

Question / Problem.

if a property is assigned with a value "200.000" the property value will be: 200 if a property is assigned with a value "200.001" the property value will be: 200.001

This is perfectly in line with

parseFloat('200.000') -> 200 and parseFloat('200.001') -> 200.001 (200 plus a fraction)

I don´t know if we can / should actually do something about it, but this feels pretty weird .. maybe we should parse to number as agressive as we do !?

In distinct case there was a number passed to an attribute "count" (200000) than formatted (via Numberformatter) for decimal delimiter and being reassigned to the same prop. At the end count has a value of 200 which is logical but still weird ..