mirror of
https://github.com/jsbin/jsbin.git
synced 2026-02-01 16:46:05 +00:00
Update to latest JSHint and escape HTML in errors found, fixing #328
This commit is contained in:
parent
343c3717dd
commit
12c46c82a3
@ -88,9 +88,9 @@ var checkForErrors = function () {
|
||||
errors = jshintErrors.errors;
|
||||
for (var i = 0; i < errors.length; i++) {
|
||||
if (typeof errors[i] == 'string') {
|
||||
html.push(errors[i]);
|
||||
html.push(escapeHTML(errors[i]));
|
||||
} else {
|
||||
html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason);
|
||||
html.push('Line ' + errors[i].line + ': ' + escapeHTML(errors[i].evidence) + ' --- ' + escapeHTML(errors[i].reason));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,14 @@ function throttle(fn, delay) {
|
||||
return throttled;
|
||||
}
|
||||
|
||||
function escapeHTML(html){
|
||||
return String(html)
|
||||
.replace(/&(?!\w+;)/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
};
|
||||
|
||||
window['jsbin'] || (window.jsbin = {});
|
||||
// dodgy?
|
||||
var storedSettings = localStorage.getItem('settings');
|
||||
|
||||
2453
public/js/vendor/jshint/jshint.js
vendored
2453
public/js/vendor/jshint/jshint.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user