metal.js
metal.js copied to clipboard
Fixes attribute deserialization when using WebComponents | Fixes #292
I've been looking at issue #292 and I've been noticing that the big problem of using boolean
when it is false
. In return of the function deserializeValue_ we have OR and as retVal
gets false the return is value
parameter that contains 'false'
.
Note
There are some use cases that want to pass a number
value to string
, we can force it into the element attribute by passing "'10'"
, but the deserializeValue_ function receives ''10''
with two single quotes and breaks the JSON.parse
, but the correct way would be to pass '"10"'
to do the parser correctly.
Please feel free to offer a solution to avoid this.
Current behavior
![screen shot 2018-04-25 at 18 28 29](https://user-images.githubusercontent.com/13750819/39276163-521ed28a-48be-11e8-8153-4d486bae3b44.png)
Expected behavior
![screen shot 2018-04-25 at 18 28 59](https://user-images.githubusercontent.com/13750819/39276160-4fe3e1e0-48be-11e8-9e37-a8db76fdad91.png)
cc @jbalsas
depends on #377
@matuzalemsteles what’s that repl-ish thing you used to make those screens?
hey @yuchi, I was using Scratches.