wavesoft / dot-dom

.dom is a tiny (512 byte) template engine that uses virtual DOM and some of react principles
Apache License 2.0
809 stars 53 forks source link

Extra space in keys? [0.4.0] #61

Closed mindplay-dk closed 4 years ago

mindplay-dk commented 4 years ago

Why the extra space in the key-name here?

https://github.com/wavesoft/dot-dom/blob/ddd6d50f9609b97f79ee9af10387598cfa19e7a5/src/dotdom.js#L197

If it's just for type-coercion, an empty string should work just as well?

wavesoft commented 4 years ago

Yeah, this is for type-coercion and compression optimisation : repeating patterns 😉

Since you don't really care about what the automatic key really contains, it should be fine

mindplay-dk commented 4 years ago

So if I understand this correctly, you're using the extra space because you've used the same " " sequence in a few other places, and this compresses better??

I think you just blew my mind LOL 🤯