Fix #25

- Only ensure that DOM elements are in the DOM before adding event
  handlers. Event handlers added to objects that will not be in the DOM
  are not added immediately (the `js/window` and `js/document` objects,
  for example).