From dec5333014fde21a886b690edf218a09af535163 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 5 Dec 2017 15:14:38 +0000 Subject: Export old code as ES6 odules Rever project find file changes --- app/assets/javascripts/syntax_highlight.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'app/assets/javascripts/syntax_highlight.js') 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 @@ //
// -$.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); } } -}; +} -- cgit v1.2.1