Check that `container` is a valid DOM element

Had another one of my friends get confused by this today.