LUI-210: Update and enhance jQuery methods for the latest jQuery version#244
LUI-210: Update and enhance jQuery methods for the latest jQuery version#244sudhanshu-raj wants to merge 1 commit intoopenmrs:masterfrom
Conversation
…and other small enhancements
| .appendTo(ul); | ||
| }; | ||
| } | ||
|
|
There was a problem hiding this comment.
More on this change : In jQuery UI 1.9+, the autocomplete widget changed its _renderItem function from using .html() to .text() when setting the label content. .text() escapes everything , so tags become literal visible text instead of HTML elements.
The old jQuery UI used .html(), so the HTML-formatted labels rendered correctly. With the newer jQuery UI bundled in Core 3.x, it switched to .text() for security reasons.
| } | ||
| jquerySelectEscaped(formFieldId).val(ui.item.object[valueField]); | ||
| if (ui.item.object && callBack) { | ||
| if (callBack) { |
There was a problem hiding this comment.
607-610 : It's just extra improvement for existing code, in this way it could not select the null object by any chance which leads to fatal exceptions.
|
Hi @dkayiwa , just a quick reminder. Please share your thoughts when you get a chance. |
|
Thanks for the update! I noticed the changes replace deprecated One question: do we already have any UI or integration tests that cover this autocomplete behavior or would it make sense to add one to ensure it works correctly with the newer jQuery version? |
Replaced deprecated .live() with .on() for jQuery 3.x compatibility, added jQuery Migrate sourced from OpenMRS Core to bridge remaining compatibility gaps, updated openmrs.js to fix the autocomplete dropdown showing raw HTML as text due to a jQuery UI 1.9 and above breaking change, and add a guard in openmrs.js to prevent a TypeError when a null item/object is selected in autocomplete.
Jira Link : https://openmrs.atlassian.net/browse/LUI-210