blikblum/tinybind

rv-each-* and rv-if may fail in combination with eachother

Closed this issue · 1 comments

tinybind may fail if rv-each-* and rv-if are used in combination with eachother. I'm not sure why this is caused, but I think it could potentially be due to order of operations: tinybind processes rv-if before rv-each-item creates the "item" accessor?

Just a guess.

Example:

<div class="navbar-item is-hoverable has-dropdown" rv-each-item="context_menus" rv-if="item.haschildren"></div>

Error:

Uncaught (in promise) TypeError: Cannot read property 'insertBefore' of null
    at Binding.bind (binders.js:281)
    at Binding.bind (bindings.js:166)
    at view.js:147
    at Array.forEach (<anonymous>)
    at View.bind (view.js:146)
    at createView (binders.js:14)
    at binders.js:88
    at Array.forEach (<anonymous>)
    at Binding.routine (binders.js:74)
    at Binding.set (bindings.js:126)

Does not look like the combination can work given the function of the if:bind it could be used in a nested capacity though

<div rv-if="true">
<ul rv-each-item="items">
....