From 556ec6de14b9cb5724833d9f6318759c00d45f84 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Jun 2019 09:29:24 +0200 Subject: [PATCH] callbacks for select2 can now handle numeric values for data attributes --- styles/bootstrap/application.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js index 0f1508b0f..7dfb584b5 100644 --- a/styles/bootstrap/application.js +++ b/styles/bootstrap/application.js @@ -5,8 +5,12 @@ * (see https://forums.select2.org/t/propperly-escape-option-value-to-prevent-xss/788) */ chzn_template_func = function (state) { - var subtitle = $(state.element).data('subtitle'); - var warning = $(state.element).data('warning'); + var subtitle = ''; + if($(state.element).data('subtitle')) + subtitle = $(state.element).data('subtitle')+''; /* make sure it is a string */ + var warning = ''; + if($(state.element).data('warning')) + warning = $(state.element).data('warning')+''; /* make sure it is a string */ var html = ''+state.text.replace(/';