modeler/angular/app/scripts/lib/$/select2/dev.js
function () {
            function resolveContainerWidth() {
                var style, attrs, matches, i, l;

                if (this.opts.width === "off") {
                    return null;
                } else if (this.opts.width === "element"){
                    return this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px';
                } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
                    // check if there is inline style on the element that contains width
                    style = this.opts.element.attr('style');
                    if (style !== undefined) {
                        attrs = style.split(';');
                        for (i = 0, l = attrs.length; i < l; i = i + 1) {
                            matches = attrs[i].replace(/\s/g, '')
                                .match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/);
                            if (matches !== null && matches.length >= 1)
                                return matches[1];
                        }
                    }

                    if (this.opts.width === "resolve") {
                        // next check if css('width') can resolve a width that is percent based, this is sometimes possible
                        // when attached to input type=hidden or elements hidden via css
                        style = this.opts.element.css('width');
                        if (style.indexOf("%") > 0) return style;

                        // finally, fallback on the calculated width of the element
                        return (this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px');
                    }

                    return null;
                } else if ($.isFunction(this.opts.width)) {
                    return this.opts.width();
                } else {
                    return this.opts.width;
               }
            };

            var width = resolveContainerWidth.call(this);
            if (width !== null) {
                this.container.attr("style", "width: "+width);
            }
        }
function () {
            function resolveContainerWidth() {
                var style, attrs, matches, i, l;

                if (this.opts.width === "off") {
                    return null;
                } else if (this.opts.width === "element"){
                    return this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px';
                } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
                    // check if there is inline style on the element that contains width
                    style = this.opts.element.attr('style');
                    if (style !== undefined) {
                        attrs = style.split(';');
                        for (i = 0, l = attrs.length; i < l; i = i + 1) {
                            matches = attrs[i].replace(/\s/g, '')
                                .match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/);
                            if (matches !== null && matches.length >= 1)
                                return matches[1];
                        }
                    }

                    if (this.opts.width === "resolve") {
                        // next check if css('width') can resolve a width that is percent based, this is sometimes possible
                        // when attached to input type=hidden or elements hidden via css
                        style = this.opts.element.css('width');
                        if (style.indexOf("%") > 0) return style;

                        // finally, fallback on the calculated width of the element
                        return (this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px');
                    }

                    return null;
                } else if ($.isFunction(this.opts.width)) {
                    return this.opts.width();
                } else {
                    return this.opts.width;
               }
            };

            var width = resolveContainerWidth.call(this);
            if (width !== null) {
                this.container.attr("style", "width: "+width);
            }
        }
function ( ) { function resolveContainerWidth ( ) { var style , attrs , matches , i , l ; if ( this . opts . width === "off" ) { return null ; } else if ( this . opts . width === "element" ) { return this . opts . element . outerWidth ( ) === 0 ? 'auto' : this . opts . element . outerWidth ( ) + 'px' ; } else if ( this . opts . width === "copy" || this . opts . width === "resolve" ) { // check if there is inline style on the element that contains width style = this . opts . element . attr ( 'style' ) ; if ( style !== undefined ) { attrs = style . split ( ';' ) ; for ( i = 0 , l = attrs . length ; i < l ; i = i + 1 ) { matches = attrs [ i ] . replace ( / \s / g , '' ) . match ( / width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc)) / ) ; if ( matches !== null && matches . length >= 1 ) return matches [ 1 ] ; } } if ( this . opts . width === "resolve" ) { // next check if css('width') can resolve a width that is percent based, this is sometimes possible // when attached to input type=hidden or elements hidden via css style = this . opts . element . css ( 'width' ) ; if ( style . indexOf ( "%" ) > 0 ) return style ; // finally, fallback on the calculated width of the element return ( this . opts . element . outerWidth ( ) === 0 ? 'auto' : this . opts . element . outerWidth ( ) + 'px' ) ; } return null ; } else if ( $ . isFunction ( this . opts . width ) ) { return this . opts . width ( ) ; } else { return this . opts . width ; } } ; var width = resolveContainerWidth . call ( this ) ; if ( width !== null ) { this . container . attr ( "style" , "width: " + width ) ; } }
Get the desired width for the container element.  This is
derived first from option `width` passed to select2, then
the inline 'style' on the original element, and finally
falls back to the jQuery calculated element width.
 abstract
Get the desired width for the container element . This is derived first from option width passed to select2 then the inline style on the original element and finally falls back to the jQuery calculated element width . abstract