code: function setFocus(document, element) {
    const inFocus = document._inFocus;
    if (element !== inFocus) {
      const inputElementImpl = idlUtils.implForWrapper(element || inFocus);
      if (inFocus) {
        const onblur = document.createEvent('HTMLEvents');
        onblur.initEvent('blur', false, false);
        const dispatchResult = inFocus.dispatchEvent(onblur);
        inFocus._blur && inFocus._blur(onblur);
      }
      if (element) { // null to blur
        const onfocus = document.createEvent('HTMLEvents');
        onfocus.initEvent('focus', false, false);
        const dispatchResult = element.dispatchEvent(onfocus);
        element._focus && element._focus(onfocus);
        document._inFocus = element;
        document.defaultView.browser.emit('focus', element);
      }
    }
  }
docs: Change the current element in focus (or null for blur)