src/inputs/multiple.js
function MultipleInput(options) {
    Selectivity.call(
        this,
        assign(
            {
                // dropdowns for multiple-value inputs should open below the select box,
                // unless there is not enough space below, but there is space enough above, then it should
                // open upwards
                positionDropdown: function(el, selectEl) {
                    var rect = selectEl.getBoundingClientRect();
                    var dropdownHeight = el.clientHeight;
                    var openUpwards =
                        rect.bottom + dropdownHeight > window.innerHeight &&
                        rect.top - dropdownHeight > 0;

                    assign(el.style, {
                        left: rect.left + 'px',
                        top: (openUpwards ? rect.top - dropdownHeight : rect.bottom) + 'px',
                        width: rect.width + 'px'
                    });
                },

                showSearchInputInDropdown: false
            },
            options
        )
    );

    this._reset();

    var events = {
        change: this.rerenderSelection,
        click: this._clicked,
        'selectivity-selected': this._resultSelected
    };
    events['change ' + INPUT_SELECTOR] = stopPropagation;
    events['click ' + SELECTED_ITEM_SELECTOR] = this._itemClicked;
    events['click ' + SELECTED_ITEM_SELECTOR + '-remove'] = this._itemRemoveClicked;
    events['keydown ' + INPUT_SELECTOR] = this._keyHeld;
    events['keyup ' + INPUT_SELECTOR] = this._keyReleased;
    events['paste ' + INPUT_SELECTOR] = this._onPaste;

    this.events.on(events);
}
function MultipleInput(options) {
    Selectivity.call(
        this,
        assign(
            {
                // dropdowns for multiple-value inputs should open below the select box,
                // unless there is not enough space below, but there is space enough above, then it should
                // open upwards
                positionDropdown: function(el, selectEl) {
                    var rect = selectEl.getBoundingClientRect();
                    var dropdownHeight = el.clientHeight;
                    var openUpwards =
                        rect.bottom + dropdownHeight > window.innerHeight &&
                        rect.top - dropdownHeight > 0;

                    assign(el.style, {
                        left: rect.left + 'px',
                        top: (openUpwards ? rect.top - dropdownHeight : rect.bottom) + 'px',
                        width: rect.width + 'px'
                    });
                },

                showSearchInputInDropdown: false
            },
            options
        )
    );

    this._reset();

    var events = {
        change: this.rerenderSelection,
        click: this._clicked,
        'selectivity-selected': this._resultSelected
    };
    events['change ' + INPUT_SELECTOR] = stopPropagation;
    events['click ' + SELECTED_ITEM_SELECTOR] = this._itemClicked;
    events['click ' + SELECTED_ITEM_SELECTOR + '-remove'] = this._itemRemoveClicked;
    events['keydown ' + INPUT_SELECTOR] = this._keyHeld;
    events['keyup ' + INPUT_SELECTOR] = this._keyReleased;
    events['paste ' + INPUT_SELECTOR] = this._onPaste;

    this.events.on(events);
}
function MultipleInput ( options ) { Selectivity . call ( this , assign ( { // dropdowns for multiple-value inputs should open below the select box, // unless there is not enough space below, but there is space enough above, then it should // open upwards positionDropdown : function ( el , selectEl ) { var rect = selectEl . getBoundingClientRect ( ) ; var dropdownHeight = el . clientHeight ; var openUpwards = rect . bottom + dropdownHeight > window . innerHeight && rect . top - dropdownHeight > 0 ; assign ( el . style , { left : rect . left + 'px' , top : ( openUpwards ? rect . top - dropdownHeight : rect . bottom ) + 'px' , width : rect . width + 'px' } ) ; } , showSearchInputInDropdown : false } , options ) ) ; this . _reset ( ) ; var events = { change : this . rerenderSelection , click : this . _clicked , 'selectivity-selected' : this . _resultSelected } ; events [ 'change ' + INPUT_SELECTOR ] = stopPropagation ; events [ 'click ' + SELECTED_ITEM_SELECTOR ] = this . _itemClicked ; events [ 'click ' + SELECTED_ITEM_SELECTOR + '-remove' ] = this . _itemRemoveClicked ; events [ 'keydown ' + INPUT_SELECTOR ] = this . _keyHeld ; events [ 'keyup ' + INPUT_SELECTOR ] = this . _keyReleased ; events [ 'paste ' + INPUT_SELECTOR ] = this . _onPaste ; this . events . on ( events ) ; }
MultipleInput Constructor.
MultipleInput Constructor .