Calling `ReactDOMServer.renderToStaticMarkup(elementWithPortal);` gets stuck in a loop while trying to do a static render.

Current behavior:
The behavior can be seen here: https://codepen.io/anon/pen/BmqWOM  by un-commenting line 58 (warning: this will make your tab freeze)

Expected behavior:
It should return with results or throw some kind of error if the input is not valid

expect(element.innerHTML).not.toEqual(lastMarkup);
      
      expect(numClicks).toEqual(1);
      ReactTestUtils.Simulate.click(ReactDOM.findDOMNode(instance.refs.span));
      expect(numClicks).toEqual(2);
    });
    
    
    
    it('should emit autofocus on the server but not focus() when hydrating', () => {
      var element = document.createElement('div');
      element.innerHTML = ReactDOMServer.renderToString(
        <input autoFocus={true} />,
      );
      expect(element.firstChild.autofocus).toBe(true);
      
      element.firstChild.focus = jest.fn();
      ReactDOM.hydrate(<input autoFocus={true} />, element);
      expect(element.firstChild.focus).not.toHaveBeenCalled();
      
      ReactDOM.render(<input autoFocus={true} />, element);
      expect(element.firstChild.focus).not.toHaveBeenCalled();
    });
    it('should not focus on either server or client with autofocus={false}', () => {
      var element = document.createElement('div');
      element.innerHTML = ReactDOMServer.renderToString(
        <input autoFocus={false} />,
      );
      expect(element.firstChild.autofocus).toBe(false);
      element.firstChild.focus = jest.fn();