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
990 990
  $(input).datepickerFallback("option", "defaultDate", default_date);
991 991
}
992
// Workaround for a performance regression in jQuery UI 1.12+ that makes
993
// sortable initialization quadratic in the number of items, freezing
994
// Chromium-based browsers on long lists such as custom field enumerations
995
// (https://github.com/jquery/jquery-ui/issues/2062).
996
// Collects all handles first and calls _removeClass/_addClass only once
997
// each, which avoids the quadratic cost while keeping the widget class
998
// tracking intact. Remove this override once the upstream fix lands.
999
if ($.ui && $.ui.sortable) {
1000
  $.ui.sortable.prototype._setHandleClassName = function() {
1001
    var handles = [];
1002
    this._removeClass(
1003
      this.element.find(".ui-sortable-handle"),
1004
      "ui-sortable-handle"
1005
    );
1006
    $.each(this.items, function() {
1007
      var handle = this.instance.options.handle;
1008
      $.merge(handles, (handle ? this.item.find(handle) : this.item).get());
1009
    });
1010
    this._addClass($(handles), "ui-sortable-handle");
1011
  };
1012
}
1013

  
992 1014
(function($){
993 1015
  $.fn.positionedItems = function(sortableOptions, options){
994 1016
    var settings = $.extend({
(2-2/2)