Project

General

Profile

Defect #44372 » 0001-Work-around-jQuery-UI-sortable-performance-regressio.patch

Go MAEDA, 2026-08-29 10:10

View differences:

app/assets/javascripts/application-legacy.js
$(input).datepickerFallback("option", "defaultDate", default_date);
}
// Workaround for a performance regression in jQuery UI 1.12+ that makes
// sortable initialization quadratic in the number of items, freezing
// Chromium-based browsers on long lists such as custom field enumerations
// (https://github.com/jquery/jquery-ui/issues/2062).
// Collects all handles first and calls _removeClass/_addClass only once
// each, which avoids the quadratic cost while keeping the widget class
// tracking intact. Remove this override once the upstream fix lands.
if ($.ui && $.ui.sortable) {
$.ui.sortable.prototype._setHandleClassName = function() {
var handles = [];
this._removeClass(
this.element.find(".ui-sortable-handle"),
"ui-sortable-handle"
);
$.each(this.items, function() {
var handle = this.instance.options.handle;
$.merge(handles, (handle ? this.item.find(handle) : this.item).get());
});
this._addClass($(handles), "ui-sortable-handle");
};
}
(function($){
$.fn.positionedItems = function(sortableOptions, options){
var settings = $.extend({
(2-2/2)