Skip to content
14 changes: 13 additions & 1 deletion timeline/webapp/timeline/sparkline/jquery.sparkline.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@

(function($) {

// Repeatedly remove all HTML comments, for complete multi-character sanitization.
function removeHtmlComments(input) {
let previous;
do {
previous = input;
input = input.replace(/<!--[\s\S]*?--\s*!?>/g, '');
} while (input !== previous);
return input;
}

/*
* Default configuration settings
*/
Expand Down Expand Up @@ -300,7 +310,9 @@
if (vals===undefined || vals===null) {
vals = $(this).html();
}
values = vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g, '').split(',');
// Remove HTML comments (<!-- ... --> and <!-- ... --!>)
vals = removeHtmlComments(vals);
values = vals.replace(/\s+/g, '').split(',');
} else {
values = uservalues;
}
Expand Down
3 changes: 2 additions & 1 deletion timeline/webapp/timeline/sparkline/ui.tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ $.widget("ui.tabs", {
},

_sanitizeSelector: function(hash) {
return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
// First escape backslashes, then escape colons
return hash.replace(/\\/g, '\\\\').replace(/:/g, '\\:'); // we need this because an id may contain a ":"
},

_cookie: function() {
Expand Down