Check that `container` is a valid DOM element