Created by: protocarl
By binding data-api events to document, we can replace the body element without losing the bindings.
This is necessary to be compatible with https://github.com/rails/turbolinks and other javascript libraries that replace body.