set selected(val) {
    // Determine true state and event names
    const trueVal = IdsStringUtils.stringToBool(val);
    const duringEventName = trueVal ? 'selected' : 'deselected';
    const beforeEventName = `before${duringEventName}`;

    // Build/Fire a `beforeselect` event that will allow an external hook to
    // determine if this menu item can be selected, or perform other actions.
    let canSelect = true;
    const beforeSelectResponse = (veto) => {
      canSelect = !!veto;
    };
    this.triggerEvent(beforeEventName, this, {
      detail: {
        elem: this,
        response: beforeSelectResponse
      }
    });
    if (!canSelect) {
      return;
    }

    // Store true state
    this.state.selected = trueVal;
    this.container.classList[trueVal ? 'add' : 'remove']('selected');
    this.a.setAttribute('aria-checked', trueVal ? 'true' : 'false');

    // Sync the attribute
    const shouldUpdate = this.shouldUpdate;
    const currentAttr = this.hasAttribute('selected');
    if (trueVal && !currentAttr) {
      this.shouldUpdate = false;
      this.setAttribute('selected', '');
      this.shouldUpdate = shouldUpdate;
    } else if (!trueVal && currentAttr) {
      this.shouldUpdate = false;
      this.removeAttribute('selected');
      this.shouldUpdate = shouldUpdate;
    }

    // Build/Fire a `selected` event for performing other actions.
    this.triggerEvent(duringEventName, this, {
      bubbles: true,
      detail: {
        elem: this,
        value: this.value
      }
    });
  }
/**
   * @param {boolean} val true if the item should be selected
   */
@param {boolean} val true if the item should be selected
@param { boolean } val true if the item should be selected
set selected(val) {
    const trueVal = IdsStringUtils.stringToBool(val);
    const duringEventName = trueVal ? 'selected' : 'deselected';
    const beforeEventName = `before${duringEventName}`;
    let canSelect = true;
    const beforeSelectResponse = (veto) => {
      canSelect = !!veto;
    };
    this.triggerEvent(beforeEventName, this, {
      detail: {
        elem: this,
        response: beforeSelectResponse
      }
    });
    if (!canSelect) {
      return;
    }
    this.state.selected = trueVal;
    this.container.classList[trueVal ? 'add' : 'remove']('selected');
    this.a.setAttribute('aria-checked', trueVal ? 'true' : 'false');
    const shouldUpdate = this.shouldUpdate;
    const currentAttr = this.hasAttribute('selected');
    if (trueVal && !currentAttr) {
      this.shouldUpdate = false;
      this.setAttribute('selected', '');
      this.shouldUpdate = shouldUpdate;
    } else if (!trueVal && currentAttr) {
      this.shouldUpdate = false;
      this.removeAttribute('selected');
      this.shouldUpdate = shouldUpdate;
    }
    this.triggerEvent(duringEventName, this, {
      bubbles: true,
      detail: {
        elem: this,
        value: this.value
      }
    });
  }
set selected ( val ) { const trueVal = IdsStringUtils . stringToBool ( val ) ; const duringEventName = trueVal ? 'selected' : 'deselected' ; const beforeEventName = ` ${ duringEventName } ` ; let canSelect = true ; const beforeSelectResponse = ( veto ) => { canSelect = ! ! veto ; } ; this . triggerEvent ( beforeEventName , this , { detail : { elem : this , response : beforeSelectResponse } } ) ; if ( ! canSelect ) { return ; } this . state . selected = trueVal ; this . container . classList [ trueVal ? 'add' : 'remove' ] ( 'selected' ) ; this . a . setAttribute ( 'aria-checked' , trueVal ? 'true' : 'false' ) ; const shouldUpdate = this . shouldUpdate ; const currentAttr = this . hasAttribute ( 'selected' ) ; if ( trueVal && ! currentAttr ) { this . shouldUpdate = false ; this . setAttribute ( 'selected' , '' ) ; this . shouldUpdate = shouldUpdate ; } else if ( ! trueVal && currentAttr ) { this . shouldUpdate = false ; this . removeAttribute ( 'selected' ) ; this . shouldUpdate = shouldUpdate ; } this . triggerEvent ( duringEventName , this , { bubbles : true , detail : { elem : this , value : this . value } } ) ; }
@param {boolean} val true if the item should be selected
@param { boolean } val true if the item should be selected
// Determine true state and event names // Build/Fire a `beforeselect` event that will allow an external hook to // determine if this menu item can be selected, or perform other actions. // Store true state // Sync the attribute // Build/Fire a `selected` event for performing other actions.