1
0
mirror of synced 2024-11-26 06:46:04 +03:00
select2/tests/dropdown
Kevin Brown e260860789 Correct positioning issues for statically positioned elements
There was a commit that landed in 4.0.1 that fixed positioning for
non-static elements, which are commonly used for the custom
`dropdownParent` option, but broke positioning for statically positioned
elements, commonly used in almost every other case. That commit was
c9216b4b96

This fixes the positioning issues caused by that commit by properly
calculating the offsets for statically positioned parents. Statically
positioned parents are unique, because the offset for the dropdown must
be calculated based on the closest element that is non-statically
positioned. Otherwise, the offset for any statically positioned parent
other than the body will be considerably higher than it should be,
resulting in the dropdown being offset by a large amount.

The offset parent for the body element is the html element, which is why
this works for both the body element and any custom parents for the
dropdown. This would not be needed if the parent wasn't customizable (as
seen in Select2 3.x) because you will never need to offset the body
element if it is statically positioned, because the html element almost
never has an offset.

This also fixes JSHint issues within the tests added in the last commit.

This closes https://github.com/select2/select2/issues/3970
This closes https://github.com/select2/select2/issues/3639
2016-01-01 17:15:00 -05:00
..
dropdownCss-tests.js Add back *css* options through an adapter 2015-04-05 21:58:02 -04:00
positioning-tests.js Correct positioning issues for statically positioned elements 2016-01-01 17:15:00 -05:00
selectOnClose-tests.js Fixed missing jQuery import 2015-01-29 09:15:02 -05:00
stopPropagation-tests.js Added modules for stopping event propagation 2015-02-09 20:04:01 -05:00