Skip to content

Commit

Permalink
Correctly escape special HTML symbols in tests output
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed May 22, 2014
1 parent f61a11b commit 5532b23
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@
P_A_C_K_E_R.run_tests(st);
Urlencoded.run_tests(st);
MyObfuscate.run_tests(st);
var results = st.results_raw().replace(/ /g, '&nbsp;').replace(/\r/g, '·').replace(/\n/g, '<br>');
var results = st.results_raw()
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/ /g, '&nbsp;')
.replace(/\r/g, '·')
.replace(/\n/g, '<br>');
$('#testresults').html(results).show();
}

Expand Down

0 comments on commit 5532b23

Please sign in to comment.