File tree Expand file tree Collapse file tree 2 files changed +21
-32
lines changed Expand file tree Collapse file tree 2 files changed +21
-32
lines changed Original file line number Diff line number Diff line change 427
427
if ( alignments . spaceOnTop > alignments . spaceOnBottom ) {
428
428
verticalAlignment = 'bottom' ;
429
429
idealHeight += alignments . spaceOnTop ;
430
- idealYPos -= this . options . coverTrigger ? alignments . spaceOnTop - 20 : alignments . spaceOnTop - 20 + triggerBRect . height ;
430
+ idealYPos -= this . options . coverTrigger
431
+ ? alignments . spaceOnTop - 20
432
+ : alignments . spaceOnTop - 20 + triggerBRect . height ;
431
433
} else {
432
434
idealHeight += alignments . spaceOnBottom ;
433
435
}
527
529
* Place dropdown
528
530
*/
529
531
_placeDropdown ( ) {
532
+ /**
533
+ * Get closest ancestor that satisfies the condition
534
+ * @param {Element } el Element to find ancestors on
535
+ * @param {Function } condition Function that given an ancestor element returns true or false
536
+ * @returns {Element } Return closest ancestor or null if none satisfies the condition
537
+ */
538
+ const getClosestAncestor = function ( el , condition ) {
539
+ let ancestor = el . parentNode ;
540
+ while ( ancestor !== null && ! $ ( ancestor ) . is ( document ) ) {
541
+ if ( condition ( ancestor ) ) {
542
+ return ancestor ;
543
+ }
544
+ ancestor = ancestor . parentNode ;
545
+ }
546
+ return null ;
547
+ } ;
548
+
530
549
// Container here will be closest ancestor with overflow: hidden
531
- let closestOverflowParent = M . getClosestAncestor ( this . dropdownEl , ( ancestor ) => {
550
+ let closestOverflowParent = getClosestAncestor ( this . dropdownEl , ( ancestor ) => {
532
551
return $ ( ancestor ) . css ( 'overflow' ) !== 'visible' ;
533
552
} ) ;
534
553
// Fallback
Original file line number Diff line number Diff line change @@ -167,36 +167,6 @@ M.escapeHash = function(hash) {
167
167
return hash . replace ( / ( : | \. | \[ | \] | , | = | \/ ) / g, '\\$1' ) ;
168
168
} ;
169
169
170
- /**
171
- * Get closest ancestor that satisfies the condition
172
- * @param {Element } el Element to find ancestors on
173
- * @param {Function } condition Function that given an ancestor element returns true or false
174
- * @returns {Element } Return closest ancestor or null if none satisfies the condition
175
- */
176
- M . getClosestAncestor = function ( el , condition ) {
177
- let ancestor = el . parentNode ;
178
- while ( ancestor !== null && ! $ ( ancestor ) . is ( document ) ) {
179
- if ( condition ( ancestor ) ) {
180
- return ancestor ;
181
- }
182
- ancestor = ancestor . parentNode ;
183
- }
184
- return null ;
185
- } ;
186
-
187
- M . elementOrParentIsFixed = function ( element ) {
188
- let $element = $ ( element ) ;
189
- let $checkElements = $element . add ( $element . parents ( ) ) ;
190
- let isFixed = false ;
191
- $checkElements . each ( function ( ) {
192
- if ( $ ( this ) . css ( 'position' ) === 'fixed' ) {
193
- isFixed = true ;
194
- return false ;
195
- }
196
- } ) ;
197
- return isFixed ;
198
- } ;
199
-
200
170
/**
201
171
* @typedef {Object } Edges
202
172
* @property {Boolean } top If the top edge was exceeded
You can’t perform that action at this time.
0 commit comments