diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-16 15:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-16 15:09:30 +0300 |
commit | e3748b81ca29b24197276767e245158d8f84fda3 (patch) | |
tree | 02b2dbe099f8e09e9e85dc71cce1bd8e858be7ac /app/assets/javascripts/lib | |
parent | 4e1af5260dc9187ca0637fcfcf56b450f6443192 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/dom_utils.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/dom_utils.js b/app/assets/javascripts/lib/utils/dom_utils.js index bca6978c206..cafee641174 100644 --- a/app/assets/javascripts/lib/utils/dom_utils.js +++ b/app/assets/javascripts/lib/utils/dom_utils.js @@ -106,3 +106,15 @@ export const setAttributes = (el, attributes) => { el.setAttribute(key, attributes[key]); }); }; + +/** + * Get the height of the wrapper page element + * This height can be used to determine where the highest element goes in a page + * Useful for gl-drawer's header-height prop + * @param {String} contentWrapperClass the content wrapper class + * @returns {String} height in px + */ +export const getContentWrapperHeight = (contentWrapperClass) => { + const wrapperEl = document.querySelector(contentWrapperClass); + return wrapperEl ? `${wrapperEl.offsetTop}px` : ''; +}; |