Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm-4881 dom text reinterpret / xss codeql warning 3 #1133

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions app/assets/javascripts/practice_page.es6
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@
const moreText = 'See more';
const lessText = 'See less';
let t = $(element).text();
let firstHalf = `${t.slice(
0,
showChar
)}<span>${ellipsesText} </span><button type="button" class="dm-button--unstyled-primary more-link">${moreText}</button>`;
let secondHalf = `<span style="display:none;">${t.slice(
showChar,
t.length
)} <button type="button" class="dm-button--unstyled-primary less-link">${lessText}</button></span>`;
let firstHalf = `${_.escape(t.slice(0, showChar))}<span>${ellipsesText} </span>
<button type="button" class="dm-button--unstyled-primary more-link">${moreText}</button>`;
let secondHalf = `<span style="display:none;">${_.escape(t.slice(showChar, t.length))}
<button type="button" class="dm-button--unstyled-primary less-link">${lessText}</button></span>`;

if (t.length < showChar) return;

$(element).html(firstHalf + secondHalf);
Expand Down
Loading