Update to latest JSHint and escape HTML in errors found, fixing #328

This commit is contained in:
Remy Sharp 2012-08-29 18:03:13 +01:00
parent 343c3717dd
commit 12c46c82a3
3 changed files with 1334 additions and 1131 deletions

View File

@ -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));
}
}

View File

@ -36,6 +36,14 @@ function throttle(fn, delay) {
return throttled;
}
function escapeHTML(html){
return String(html)
.replace(/&(?!\w+;)/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
};
window['jsbin'] || (window.jsbin = {});
// dodgy?
var storedSettings = localStorage.getItem('settings');

File diff suppressed because it is too large Load Diff