That appears unnecessary to me.
Conditional bindings without any scripting perfectly perform the task. You do not need to script for this kind of task.
I just checked with one of my example forms:
$.Legobrick.[Color<>"green"]
works perfectly to bind only subforms where the underlying element "Color" does not have the value "green".