Created by: mhuggins
By binding data-api events to document without relying on document ready, 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.
See #5308, which made similar changes to other parts of the data-api.