| 1943 | function clearEntryList($list) { | 1943 | function clearEntryList($list) { |
| 1944 | console.time('clearEntryList'); | 1944 | console.time('clearEntryList'); |
| 1945 | | 1945 | |
| | 1946 | // List already empty, skipping cleanup |
| 1946 | if (!$list.children().length) { | 1947 | if (!$list.children().length) { |
| 1947 | console.debug('List already empty, skipping cleanup.'); | | |
| 1948 | console.timeEnd('clearEntryList'); | 1948 | console.timeEnd('clearEntryList'); |
| 1949 | return; | 1949 | return; |
| 1950 | } | 1950 | } |
| 1951 | | 1951 | |
| | 1952 | // Unsubscribe from toggle events, so that mass open won't create new drawers |
| | 1953 | $list.find('.inline-drawer').off('inline-drawer-toggle'); |
| | 1954 | |
| 1952 | // Step 1: Clean all <option> elements within <select> | 1955 | // Step 1: Clean all <option> elements within <select> |
| 1953 | $list.find('option').each(function () { | 1956 | $list.find('option').each(function () { |
| 1954 | const $option = $(this); | 1957 | const $option = $(this); |