nettybun / haptic

Explicit reactive web rendering in TSX with no compiler, no virtual DOM, and no magic. 1.6kb min+gz.
MIT License
79 stars 2 forks source link

Arrays are treated as objects #12

Closed brecert closed 3 years ago

brecert commented 3 years ago

https://github.com/heyheyhello/haptic/blob/main/src/dom/h.ts#L38

Arrays are considered to be an object by typeof, typeof arg is being checked before first checking if it's an array, leading to all arrays being treated as an object.

A simple fix is to move the array check to be before the object check.

nettybun commented 3 years ago

Hi Bree! Nice catch, that makes sense. Maybe you can tell I haven't ran a lot of Haptic's code yet 😅 This is was adapted from https://github.com/luwes/sinuous/blob/master/packages/sinuous/h/src/h.js and I set out to remove its nested item() function, but clearly I never ended up testing it - I'll be putting some time into #3 soon.

I'll leave some comments in the PR.