Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-12-13 12:26:44 +0300
committerPhil Hughes <me@iamphill.com>2017-12-13 12:26:44 +0300
commitaa90e8ea5b025dc5de5887b2694e25745bf97e48 (patch)
tree9700aa80f7be849a0cab14e3313a35b0db41f2a4 /app/assets/javascripts/syntax_highlight.js
parentbcb14a0dbb729ab88ef5eb93ad7a4694ed8cac9d (diff)
Export old code into es6 modules
Diffstat (limited to 'app/assets/javascripts/syntax_highlight.js')
-rw-r--r--app/assets/javascripts/syntax_highlight.js14
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);
}
}
-};
+}