From 8771232293cf6e9a1aed77b5e8f9dbaceb8590a2 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 7 May 2020 10:10:18 -0300 Subject: [PATCH] Bug 25279: (QA follow-up) Use .escapeHtml Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt index e4c7aa5a7d..618e757773 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt @@ -186,7 +186,7 @@ "targets": [0,1,2,3,4], "render": function (data, type, row, meta) { if ( type == 'display' ) { - return $('
').text(data).html(); + return data.escapeHtml(); } return data; } diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 4c6f96c92b..fad4d616b0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -26,6 +26,13 @@ String.prototype.escapeHtml = function() { }); }; +/* + * Void method for numbers, for consistency + */ +Number.prototype.escapeHtml = function() { + return this; +}; + // http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804 $.fn.tabIndex = function () { return $(this).parent().children('div').index(this); -- 2.39.5