Bug 25279: (QA follow-up) Use .escapeHtml
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 7 May 2020 13:10:18 +0000 (10:10 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 12 May 2020 10:40:22 +0000 (11:40 +0100)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt
koha-tmpl/intranet-tmpl/prog/js/staff-global.js

index e4c7aa5..618e757 100644 (file)
                     "targets": [0,1,2,3,4],
                     "render": function (data, type, row, meta) {
                         if ( type == 'display' ) {
-                            return $('<div />').text(data).html();
+                            return data.escapeHtml();
                         }
                         return data;
                     }
index 4c6f96c..fad4d61 100644 (file)
@@ -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);