src/dual-listbox.js
/**
     * Add the listItem to the selected list.
     *
     * @param {NodeElement} listItem
     */
Add the listItem to the selected list.
Add the listItem to the selected list .
addSelected(listItem) {
        let index = this.available.indexOf(listItem);
        if (index > -1) {
            this.available.splice(index, 1);
            this.selected.push(listItem);
            this._selectOption(listItem.dataset.id);
            this.redraw();
            setTimeout(() => {
                let event = document.createEvent("HTMLEvents");
                event.initEvent("added", false, true);
                event.addedElement = listItem;
                this.dualListbox.dispatchEvent(event);
            }, 0);
        }
    }
addSelected ( listItem ) { let index = this . available . indexOf ( listItem ) ; if ( index > - 1 ) { this . available . splice ( index , 1 ) ; this . selected . push ( listItem ) ; this . _selectOption ( listItem . dataset . id ) ; this . redraw ( ) ; setTimeout ( ( ) => { let event = document . createEvent ( "HTMLEvents" ) ; event . initEvent ( "added" , false , true ) ; event . addedElement = listItem ; this . dualListbox . dispatchEvent ( event ) ; } , 0 ) ; } }
Add the listItem to the selected list.
Add the listItem to the selected list .