diff --git a/app/assets/javascripts/practice_page.es6 b/app/assets/javascripts/practice_page.es6 index d928f3900..704c59873 100644 --- a/app/assets/javascripts/practice_page.es6 +++ b/app/assets/javascripts/practice_page.es6 @@ -56,14 +56,11 @@ const moreText = 'See more'; const lessText = 'See less'; let t = $(element).text(); - let firstHalf = `${t.slice( - 0, - showChar - )}${ellipsesText} `; - let secondHalf = `${t.slice( - showChar, - t.length - )} `; + let firstHalf = `${_.escape(t.slice(0, showChar))}${ellipsesText} + `; + let secondHalf = `${_.escape(t.slice(showChar, t.length))} + `; + if (t.length < showChar) return; $(element).html(firstHalf + secondHalf);