This repository was archived by the owner on May 29, 2019. It is now read-only.
feat(position): Access width and height for hidden fields #1036
+131
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To avoid being too wordy: collapse.js needs to be able to query the height of invisible (collapsed) elements. Previous hack involved removing
.collapse
and re-adding it after. This is not a very good solution (although it is probably the least verbose).jQuery provides a swapping mechanism here, which allows the height/width of hidden elements to be shown
https://github.com/jquery/jquery/blob/94ae7133449b2d0f5aab7e1a7f7190be65924145/src/css.js#L349
I propose adding height/width helpers to $position (and perhaps, just wrapping jQuery if jQuery is present), removing them from collapse.js (in #934 / #1001).
Additionally, it might be helpful to provide this behaviour for
$position.offset
as well, but I'm not sure.