Element chaining

This patch enables to pass also functions to elements() call. When the object that should be resolved as an element is callable, then it is called like elements(o()). This makes possible to chain functions that depend on some parent element without worrying about some of them being stale because all the element chain will be resolved on each call.