|
68 | 68 | * 3. If still do not have a valid DOM element to append to, then append to the document body.
|
69 | 69 | *
|
70 | 70 | * NOTE: this.element and this.document are jQuery objects per the jQuery UI widget API.
|
71 |
| - * @returns {object} jQuery object to append to or document body. |
| 71 | + * @returns {object} jQuery object for the DOM element to append to. |
72 | 72 | */
|
73 | 73 | _getAppendEl: function() {
|
74 | 74 | var elem = this.options.appendTo; // jQuery object or selector, DOM element or null.
|
|
80 | 80 | elem = this.element.closest(".ui-front, dialog");
|
81 | 81 | }
|
82 | 82 | if (!elem.length) {
|
83 |
| - elem = document.body; // Position at end of body. Note that this returns a DOM element. |
| 83 | + elem = $(document.body); // Position at end of body. Note that this returns a DOM element. |
84 | 84 | }
|
85 | 85 | return elem;
|
86 | 86 | },
|
|
169 | 169 | var $checkboxes = (this.$checkboxes = $( document.createElement('ul') ) )
|
170 | 170 | .addClass('ui-multiselect-checkboxes ui-helper-reset' + (/\bmenu\b/i.test(wrapText) ? '' : ' ui-multiselect-nowrap'));
|
171 | 171 |
|
172 |
| - // This is the menu that will hold all the options. |
| 172 | + // This is the menu container that will hold all the options added via refresh(). |
173 | 173 | var $menu = (this.$menu = $( document.createElement('div') ) )
|
174 | 174 | .addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all'
|
175 | 175 | + (elSelect.multiple ? '' : ' ui-multiselect-single ')
|
176 | 176 | + (classes ? ' ' + classes : ''))
|
177 | 177 | .append($header, $checkboxes);
|
178 | 178 |
|
179 | 179 | $button.insertAfter($element);
|
180 |
| - // This is an empty menu at this point. |
181 |
| - $menu.appendTo( this._getAppendEl() ); |
| 180 | + this._getAppendEl().append($menu); |
182 | 181 |
|
183 | 182 | this._bindEvents();
|
184 | 183 |
|
|
731 | 730 | /**
|
732 | 731 | * Converts dimensions specified in options to pixel values.
|
733 | 732 | * Determines if specified value is a minimum, maximum or exact value.
|
734 |
| - * The value can be a number or a string with px, pts, ems, or % units. |
| 733 | + * The value can be a number or a string with px, pts, ems, in, cm, mm, or % units. |
735 | 734 | * Number/Numeric string treated as pixel measurements
|
736 | 735 | * - 30
|
737 | 736 | * - '30'
|
|
936 | 935 | /**
|
937 | 936 | * Calculate accurate outerWidth(false) using getBoundingClientRect()
|
938 | 937 | * Note that this presumes that the element is visible in the layout.
|
939 |
| - * @param {node} DOM node or jQuery equivalent get width for. |
| 938 | + * @param {node} DOM node or jQuery equivalent to get width for. |
940 | 939 | * @returns {float} Decimal floating point value for the width.
|
941 | 940 | */
|
942 | 941 | _getBCRWidth: function(elem) {
|
|
950 | 949 | /**
|
951 | 950 | * Calculate accurate outerHeight(false) using getBoundingClientRect()
|
952 | 951 | * Note that this presumes that the element is visible in the layout.
|
953 |
| - * @param {node} DOM node or jQuery equivalent get height for. |
| 952 | + * @param {node} DOM node or jQuery equivalent to get height for. |
954 | 953 | * @returns {float} Decimal floating point value for the height.
|
955 | 954 | */
|
956 | 955 | _getBCRHeight: function(elem) {
|
|
964 | 963 | /**
|
965 | 964 | * Calculate jQuery width correction factor to fix floating point round-off errors.
|
966 | 965 | * Note that this presumes that the element is visible in the layout.
|
967 |
| - * @param {node} DOM node or jQuery equivalent get width for. |
| 966 | + * @param {node} DOM node or jQuery equivalent to get width for. |
968 | 967 | * @returns {float} Correction value for the width--typically a decimal < 1.0
|
969 | 968 | */
|
970 | 969 | _jqWidthFix: function(elem) {
|
|
979 | 978 | /**
|
980 | 979 | * Calculate jQuery height correction factor to fix floating point round-off errors.
|
981 | 980 | * Note that this presumes that the element is visible in the layout.
|
982 |
| - * @param {node} DOM node or jQuery equivalent get height for. |
| 981 | + * @param {node} DOM node or jQuery equivalent to get height for. |
983 | 982 | * @returns {float} Correction value for the height--typically a decimal < 1.0
|
984 | 983 | */
|
985 | 984 | _jqHeightFix: function(elem) {
|
|
1090 | 1089 | * Potentially scoped down to visible elements from filteredInputs
|
1091 | 1090 | * @param {string} flag checked property to set
|
1092 | 1091 | * @param {object} group option group that was clicked, if any
|
1093 |
| - * @param {array} filteredInputs visible elements with the filter applied |
| 1092 | + * @param {boolean} filteredInputs does not toggle hidden inputs if filtering. |
1094 | 1093 | */
|
1095 | 1094 | _toggleChecked: function(flag, group, filteredInputs) {
|
1096 | 1095 | var self = this;
|
1097 | 1096 | var $element = self.element;
|
1098 |
| - var $inputs = (group && group.length) ? group : (filteredInputs || self.$inputs); |
| 1097 | + var $inputs = (group && group.length) ? group : self.$inputs; |
| 1098 | + |
| 1099 | + if (filteredInputs) { |
| 1100 | + // Do not include hidden inputs if the menu isn't open. |
| 1101 | + $inputs = $inputs.not( self._isOpen ? ':disabled, :hidden' : ':disabled' ); |
| 1102 | + } |
| 1103 | + else { |
| 1104 | + // If not filtering, then the underlying select is cleared out each time. |
| 1105 | + $element[0].selectedIndex = -1; |
| 1106 | + } |
1099 | 1107 |
|
1100 | 1108 | // toggle state on inputs
|
1101 | 1109 | $inputs.each(self._toggleState('checked', flag));
|
|
1113 | 1121 | });
|
1114 | 1122 |
|
1115 | 1123 | // toggle state on original option tags
|
1116 |
| - $element[0].selectedIndex = -1; |
1117 | 1124 | $element.find('option')
|
1118 | 1125 | .each( function() {
|
1119 | 1126 | if (!this.disabled && values[this.value]) {
|
|
0 commit comments