function(element) {
      var node = element[0] || element;

      document.addEventListener('click', function focusOnClick(ev) {
        if (ev.target === node && ev.$focus) {
          node.focus();
          ev.stopImmediatePropagation();
          ev.preventDefault();
          node.removeEventListener('click', focusOnClick);
        }
      }, true);

      var newEvent = document.createEvent('MouseEvents');
      newEvent.initMouseEvent('click', false, true, window, {}, 0, 0, 0, 0,
        false, false, false, false, 0, null);
      newEvent.$material = true;
      newEvent.$focus = true;
      node.dispatchEvent(newEvent);
    }
function(element) {
      var node = element[0] || element;

      document.addEventListener('click', function focusOnClick(ev) {
        if (ev.target === node && ev.$focus) {
          node.focus();
          ev.stopImmediatePropagation();
          ev.preventDefault();
          node.removeEventListener('click', focusOnClick);
        }
      }, true);

      var newEvent = document.createEvent('MouseEvents');
      newEvent.initMouseEvent('click', false, true, window, {}, 0, 0, 0, 0,
        false, false, false, false, 0, null);
      newEvent.$material = true;
      newEvent.$focus = true;
      node.dispatchEvent(newEvent);
    }
function ( element ) { var node = element [ 0 ] || element ; document . addEventListener ( 'click' , function focusOnClick ( ev ) { if ( ev . target === node && ev . $focus ) { node . focus ( ) ; ev . stopImmediatePropagation ( ) ; ev . preventDefault ( ) ; node . removeEventListener ( 'click' , focusOnClick ) ; } } , true ) ; var newEvent = document . createEvent ( 'MouseEvents' ) ; newEvent . initMouseEvent ( 'click' , false , true , window , { } , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null ) ; newEvent . $material = true ; newEvent . $focus = true ; node . dispatchEvent ( newEvent ) ; }
Mobile safari only allows you to set focus in click event listeners...
Mobile safari only allows you to set focus in click event listeners ...
This function is called by the focusOnClick function of the element