batman.js

'data-renderif' in Batman.js


What exactly does the data-renderif attribute do with Batman.js?

I initially thought that it would render the DOM node only if the attribute value would be true. But then there's data-insertif that does that as expected.


Solution

  • data-renderif is only meant to defer evaluating the bindings of a node's children until the binding value is updated to true. You probably want to use it in conjunction with data-insertif or data-removeif.

    The dataChange method for this binding can be viewed here. This function basically just removes the data-renderif attribute and initializes the children node's bindings.