diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-13 09:26:44 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-12-13 09:26:44 +0000 |
commit | aa90e8ea5b025dc5de5887b2694e25745bf97e48 (patch) | |
tree | 9700aa80f7be849a0cab14e3313a35b0db41f2a4 /app/assets/javascripts/syntax_highlight.js | |
parent | bcb14a0dbb729ab88ef5eb93ad7a4694ed8cac9d (diff) | |
download | gitlab-ce-aa90e8ea5b025dc5de5887b2694e25745bf97e48.tar.gz |
Export old code into es6 modules
Diffstat (limited to 'app/assets/javascripts/syntax_highlight.js')
-rw-r--r-- | app/assets/javascripts/syntax_highlight.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/app/assets/javascripts/syntax_highlight.js b/app/assets/javascripts/syntax_highlight.js index 662d6b36c16..62bdef76c55 100644 --- a/app/assets/javascripts/syntax_highlight.js +++ b/app/assets/javascripts/syntax_highlight.js @@ -10,17 +10,15 @@ // <div class="js-syntax-highlight"></div> // -$.fn.syntaxHighlight = function() { - var $children; - - if ($(this).hasClass('js-syntax-highlight')) { +export default function syntaxHighlight(el) { + if ($(el).hasClass('js-syntax-highlight')) { // Given the element itself, apply highlighting - return $(this).addClass(gon.user_color_scheme); + return $(el).addClass(gon.user_color_scheme); } else { // Given a parent element, recurse to any of its applicable children - $children = $(this).find('.js-syntax-highlight'); + const $children = $(el).find('.js-syntax-highlight'); if ($children.length) { - return $children.syntaxHighlight(); + return syntaxHighlight($children); } } -}; +} |