szn-options.js
function updateMultiSelection(instance, lastHoveredItem) {
    const startIndex = instance._dragSelectionStartOption.index
    const lastIndex = lastHoveredItem._option.index
    const minIndex = Math.min(startIndex, lastIndex)
    const maxIndex = Math.max(startIndex, lastIndex)
    const options = instance._options.options
    const additionalIndexes = instance._additionalSelectedIndexes

    for (let i = 0, length = options.length; i < length; i++) {
      const option = options.item(i)
      if (isOptionEnabled(option)) {
        let isOptionSelected = additionalIndexes.indexOf(i) > -1
        if (i >= minIndex && i <= maxIndex) {
          isOptionSelected = !instance._invertSelection
        }
        option.selected = isOptionSelected
      }
    }

    instance._options.dispatchEvent(new CustomEvent('change', {bubbles: true, cancelable: true}))
  }
function updateMultiSelection(instance, lastHoveredItem) {
    const startIndex = instance._dragSelectionStartOption.index
    const lastIndex = lastHoveredItem._option.index
    const minIndex = Math.min(startIndex, lastIndex)
    const maxIndex = Math.max(startIndex, lastIndex)
    const options = instance._options.options
    const additionalIndexes = instance._additionalSelectedIndexes

    for (let i = 0, length = options.length; i < length; i++) {
      const option = options.item(i)
      if (isOptionEnabled(option)) {
        let isOptionSelected = additionalIndexes.indexOf(i) > -1
        if (i >= minIndex && i <= maxIndex) {
          isOptionSelected = !instance._invertSelection
        }
        option.selected = isOptionSelected
      }
    }

    instance._options.dispatchEvent(new CustomEvent('change', {bubbles: true, cancelable: true}))
  }
function updateMultiSelection ( instance , lastHoveredItem ) { const startIndex = instance . _dragSelectionStartOption . index const lastIndex = lastHoveredItem . _option . index const minIndex = Math . min ( startIndex , lastIndex ) const maxIndex = Math . max ( startIndex , lastIndex ) const options = instance . _options . options const additionalIndexes = instance . _additionalSelectedIndexes for ( let i = 0 , length = options . length ; i < length ; i ++ ) { const option = options . item ( i ) if ( isOptionEnabled ( option ) ) { let isOptionSelected = additionalIndexes . indexOf ( i ) > - 1 if ( i >= minIndex && i <= maxIndex ) { isOptionSelected = ! instance . _invertSelection } option . selected = isOptionSelected } } instance . _options . dispatchEvent ( new CustomEvent ( 'change' , { bubbles : true , cancelable : true } ) ) }
Updates the multiple-items selection. This function is meant to be used with multi-selects when the user is
selecting multiple items by dragging the mouse pointer over them.

Any item which's index is in the provided instance's list of additionally selected items will be marked as
selected as well.

@param {SznElements.SznOptions} instance The szn-options element instance.
@param {Element} lastHoveredItem The element representing the UI of the last option the user has hovered using
their mouse pointer.
Updates the multiple - items selection . This function is meant to be used with multi - selects when the user is selecting multiple items by dragging the mouse pointer over them .