nl_tokens: Create a settings menu item
pl_tokens: function createMenuItem ( _ref ) { var _this3 = this ; var value = _ref . value , list = _ref . list , type = _ref . type , title = _ref . title , _ref$badge = _ref . badge , badge = _ref$badge === void 0 ? null : _ref$badge , _ref$checked = _ref . checked , checked = _ref$checked === void 0 ? false : _ref$checked ; var attributes = getAttributesFromSelector ( this . config . selectors . inputs [ type ] ) ; var menuItem = createElement ( 'button' , extend ( attributes , { type : 'button' , role : 'menuitemradio' , class : "" . concat ( this . config . classNames . control , " " ) . concat ( attributes . class ? attributes . class : '' ) . trim ( ) , 'aria-checked' : checked , value : value } ) ) ; var flex = createElement ( 'span' ) ; // We have to set as HTML incase of special characters flex . innerHTML = title ; if ( is$1 . element ( badge ) ) { flex . appendChild ( badge ) ; } menuItem . appendChild ( flex ) ; // Replicate radio button behaviour Object . defineProperty ( menuItem , 'checked' , { enumerable : true , get : function get ( ) { return menuItem . getAttribute ( 'aria-checked' ) === 'true' ; } , set : function set ( checked ) { // Ensure exclusivity if ( checked ) { Array . from ( menuItem . parentNode . children ) . filter ( function ( node ) { return matches$1 ( node , '[role="menuitemradio"]' ) ; } ) . forEach ( function ( node ) { return node . setAttribute ( 'aria-checked' , 'false' ) ; } ) ; } menuItem . setAttribute ( 'aria-checked' , checked ? 'true' : 'false' ) ; } } ) ; this . listeners . bind ( menuItem , 'click keyup' , function ( event ) { if ( is$1 . keyboardEvent ( event ) && event . which !== 32 ) { return ; } event . preventDefault ( ) ; event . stopPropagation ( ) ; menuItem . checked = true ; switch ( type ) { <mask> 'language' : _this3 . currentTrack = Number ( value ) ; break ; case 'quality' : _this3 . quality = value ; break ; case 'speed' : _this3 . speed = parseFloat ( value ) ; break ; default : break ; } controls . showMenuPanel . call ( _this3 , 'home' , is$1 . keyboardEvent ( event ) ) ; } , type , false ) ; controls . bindMenuItemShortcuts . call ( this , menuItem , type ) ; list . appendChild ( menuItem ) ; }