diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-12-05 15:14:38 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-12-05 17:51:08 +0000 |
commit | dec5333014fde21a886b690edf218a09af535163 (patch) | |
tree | 6266caa6b84db54515d39e42b4b9ccc9c1cda101 /app/assets/javascripts/syntax_highlight.js | |
parent | 9f75b7a47fbfe352f7b099769861b1cc0a9617eb (diff) | |
download | gitlab-ce-38869-es6.tar.gz |
Export old code as ES6 odules38869-es6
Rever project find file changes
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..3c6a3305cb9 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(element) { + if ($(element).hasClass('js-syntax-highlight')) { // Given the element itself, apply highlighting - return $(this).addClass(gon.user_color_scheme); + return $(element).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 = $(element).find('.js-syntax-highlight'); if ($children.length) { - return $children.syntaxHighlight(); + return syntaxHighlight($children); } } -}; +} |