From 9444fcfba4896fd4a272985f18ff157da303e3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20G=C3=B6elzer=20Portolann=20Malkiewiez?= Date: Fri, 24 Jun 2022 09:32:19 -0300 Subject: [PATCH 1/2] Datepicker: Make sure altField is treated as a CSS selector [SO-2932013] --- ui/datepicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/datepicker.js b/ui/datepicker.js index 155bbc61929..1462cb5cad2 100644 --- a/ui/datepicker.js +++ b/ui/datepicker.js @@ -1071,7 +1071,7 @@ $.extend(Datepicker.prototype, { altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); date = this._getDate(inst); dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); - $(altField).each(function() { $(this).val(dateStr); }); + $(document).find(altField).val(dateStr); } }, From 570cde465bf166ade298df21904b1762379e5d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20G=C3=B6elzer=20Portolann=20Malkiewiez?= Date: Fri, 24 Jun 2022 10:09:36 -0300 Subject: [PATCH 2/2] Datepicker: Make sure text option are text, shorten HTML strings [SO-2932013] --- ui/datepicker.js | 136 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 115 insertions(+), 21 deletions(-) diff --git a/ui/datepicker.js b/ui/datepicker.js index 1462cb5cad2..8dcaa077eca 100644 --- a/ui/datepicker.js +++ b/ui/datepicker.js @@ -227,7 +227,9 @@ $.extend(Datepicker.prototype, { inst.append.remove(); } if (appendText) { - inst.append = $("" + appendText + ""); + inst.append = $("") + .addClass(this._appendClass) + .text(appendText); input[isRTL ? "before" : "after"](inst.append); } @@ -244,12 +246,32 @@ $.extend(Datepicker.prototype, { if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked buttonText = this._get(inst, "buttonText"); buttonImage = this._get(inst, "buttonImage"); - inst.trigger = $(this._get(inst, "buttonImageOnly") ? - $("").addClass(this._triggerClass). - attr({ src: buttonImage, alt: buttonText, title: buttonText }) : - $("").addClass(this._triggerClass). - html(!buttonImage ? buttonText : $("").attr( - { src:buttonImage, alt:buttonText, title:buttonText }))); + + if (this._get(inst, "buttonImageOnly")) { + inst.trigger = $("") + .addClass(this._triggerClass) + .attr({ + src: buttonImage, + alt: buttonText, + title: buttonText + }); + } else { + inst.trigger = $("" : ""); - - buttonPanel = (showButtonPanel) ? "
" + (isRTL ? controls : "") + - (this._isInRange(inst, gotoDate) ? "" : "") + (isRTL ? "" : controls) + "
" : ""; + controls = ""; + if (!inst.inline) { + controls = $("