diff options
author | Bryce Johnson <bryce@gitlab.com> | 2017-07-03 21:51:17 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-07-03 21:51:17 +0000 |
commit | 3319c7999f95d19dcdcae3d57869f8dd7002a0e1 (patch) | |
tree | d15ce9728144ce1883045719753fd6d088e871cd | |
parent | 049d4baed0f3532359feb729c5f0938d3d4518ef (diff) | |
download | gitlab-ce-3319c7999f95d19dcdcae3d57869f8dd7002a0e1.tar.gz |
Make autosize fields more performant and remove broken autosize handle
-rw-r--r-- | app/assets/javascripts/behaviors/autosize.js | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/app/assets/javascripts/behaviors/autosize.js b/app/assets/javascripts/behaviors/autosize.js index 3bea460dcc6..e00af4b2fa8 100644 --- a/app/assets/javascripts/behaviors/autosize.js +++ b/app/assets/javascripts/behaviors/autosize.js @@ -1,23 +1,8 @@ import autosize from 'vendor/autosize'; -$(() => { - const $fields = $('.js-autosize'); +document.addEventListener('DOMContentLoaded', () => { + const autosizeEls = document.querySelectorAll('.js-autosize'); - $fields.on('autosize:resized', function resized() { - const $field = $(this); - $field.data('height', $field.outerHeight()); - }); - - $fields.on('resize.autosize', function resize() { - const $field = $(this); - if ($field.data('height') !== $field.outerHeight()) { - $field.data('height', $field.outerHeight()); - autosize.destroy($field); - $field.css('max-height', window.outerHeight); - } - }); - - autosize($fields); - autosize.update($fields); - $fields.css('resize', 'vertical'); + autosize(autosizeEls); + autosize.update(autosizeEls); }); |