function _updateSelections( value ) {
    var optionIndex =
      arrayHelpers.indexOfObject( _optionsData, 'value', value );
    var option = _optionsData[optionIndex] || _optionsData[_index];

    if ( option ) {
      var _selectionsItemDom;

      if ( option.checked ) {
        if ( _optionsDom.classList.contains( 'max-selections' ) ) {
          _optionsDom.classList.remove( 'max-selections' );
        }

        var dataOptionSel = '[data-option="' + option.value + '"]';
        _selectionsItemDom = _selectionsDom.querySelector( dataOptionSel );

        if ( _selectionsItemDom ) {
          _selectionsDom.removeChild( _selectionsItemDom );
        }
        option.checked = false;
        _selectionsCount -= 1;
      } else {
        _selectionsItemDom = domCreate( 'li', {
          'data-option': option.value
        } );

        domCreate( 'label', {
          'for':       option.value,
          'innerHTML': option.text,
          'inside':    _selectionsItemDom
        } );

        _selectionsDom.appendChild( _selectionsItemDom );

        option.checked = true;
        _selectionsCount += 1;

        if ( _selectionsCount >= MAX_SELECTIONS ) {
          _optionsDom.classList.add( 'max-selections' );
        }
      }
    }

    _index = -1;
    _isBlurSkipped = false;

    if ( _fieldsetDom.getAttribute( 'aria-hidden' ) === 'false' ) {
      _searchDom.focus();
    }
  }
/**
   * Tracks a user's selections and updates the list in the dom.
   * @param   {string} value The value of the option the user has chosen.
   */
Tracks a user's selections and updates the list in the dom.
@param   {string} value The value of the option the user has chosen.
Tracks a user ' s selections and updates the list in the dom . @param { string } value The value of the option the user has chosen .
function _updateSelections( value ) {
    var optionIndex =
      arrayHelpers.indexOfObject( _optionsData, 'value', value );
    var option = _optionsData[optionIndex] || _optionsData[_index];
    if ( option ) {
      var _selectionsItemDom;
      if ( option.checked ) {
        if ( _optionsDom.classList.contains( 'max-selections' ) ) {
          _optionsDom.classList.remove( 'max-selections' );
        }
        var dataOptionSel = '[data-option="' + option.value + '"]';
        _selectionsItemDom = _selectionsDom.querySelector( dataOptionSel );
        if ( _selectionsItemDom ) {
          _selectionsDom.removeChild( _selectionsItemDom );
        }
        option.checked = false;
        _selectionsCount -= 1;
      } else {
        _selectionsItemDom = domCreate( 'li', {
          'data-option': option.value
        } );
        domCreate( 'label', {
          'for':       option.value,
          'innerHTML': option.text,
          'inside':    _selectionsItemDom
        } );
        _selectionsDom.appendChild( _selectionsItemDom );
        option.checked = true;
        _selectionsCount += 1;
        if ( _selectionsCount >= MAX_SELECTIONS ) {
          _optionsDom.classList.add( 'max-selections' );
        }
      }
    }
    _index = -1;
    _isBlurSkipped = false;
    if ( _fieldsetDom.getAttribute( 'aria-hidden' ) === 'false' ) {
      _searchDom.focus();
    }
  }
function _updateSelections ( value ) { var optionIndex = arrayHelpers . indexOfObject ( _optionsData , 'value' , value ) ; var option = _optionsData [ optionIndex ] || _optionsData [ _index ] ; if ( option ) { var _selectionsItemDom ; if ( option . checked ) { if ( _optionsDom . classList . contains ( 'max-selections' ) ) { _optionsDom . classList . remove ( 'max-selections' ) ; } var dataOptionSel = '[data-option="' + option . value + '"]' ; _selectionsItemDom = _selectionsDom . querySelector ( dataOptionSel ) ; if ( _selectionsItemDom ) { _selectionsDom . removeChild ( _selectionsItemDom ) ; } option . checked = false ; _selectionsCount -= 1 ; } else { _selectionsItemDom = domCreate ( 'li' , { 'data-option' : option . value } ) ; domCreate ( 'label' , { 'for' : option . value , 'innerHTML' : option . text , 'inside' : _selectionsItemDom } ) ; _selectionsDom . appendChild ( _selectionsItemDom ) ; option . checked = true ; _selectionsCount += 1 ; if ( _selectionsCount >= MAX_SELECTIONS ) { _optionsDom . classList . add ( 'max-selections' ) ; } } } _index = - 1 ; _isBlurSkipped = false ; if ( _fieldsetDom . getAttribute ( 'aria-hidden' ) === 'false' ) { _searchDom . focus ( ) ; } }
Tracks a user's selections and updates the list in the dom.
Tracks a user ' s selections and updates the list in the dom .