# all files / src/mixins/ PopupElement.js

40% Statements 2/5
0% Branches 0/4
0% Functions 0/2
40% Lines 2/5

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42

    1×

    1×

     /**
     * PopupElement is mixed into other classes to generate a {@link OO.ui.PopupWidget popup widget}.
     * A popup is a container for content. It is overlaid and positioned absolutely. By default, each
     * popup has an anchor, which is an arrow-like protrusion that points toward the popup’s origin.
     * See {@link OO.ui.PopupWidget PopupWidget} for an example.
     *
     * @abstract
     * @class
     *
     * @constructor
     * @param {Object} [config] Configuration options
     * @cfg {Object} [popup] Configuration to pass to popup
     * @cfg {boolean} [popup.autoClose=true] Popup auto-closes when it loses focus
     */
    OO.ui.mixin.PopupElement = function OoUiMixinPopupElement( config ) {
    	// Configuration initialization
    	config = config || {};

    	// Properties
    	this.popup = new OO.ui.PopupWidget( $.extend(
    		{
    			autoClose: true,
    			$floatableContainer: this.$element
    		},
    		config.popup,
    		{
    			$autoCloseIgnore: this.$element.add( config.popup && config.popup.$autoCloseIgnore )
    		}
    	) );
    };

    /* Methods */

    /**
     * Get popup.
     *
     * @return {OO.ui.PopupWidget} Popup widget
     */
    OO.ui.mixin.PopupElement.prototype.getPopup = function () {
    	return this.popup;
    };