Remove debug logs with DOM queries

0f9cd5f48d9d3ac1c66e83d7c8581360915c5acf

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -18Showing whitespace changes
public/scripts/world-info.js+2 -18
@@ -1943,23 +1943,20 @@ function clearEntryList() {
19431943
19441944
19451945 if (!$list.children().length) {
19461946 console.warndebug('List already empty, skipping cleanup.');
19471947 console.timeEnd('clearEntryList');
19481948 return;
19491949 }
19501950
19511951 // Step 1: Clean all <option> elements within <select>
1952- console.warn(`Before cleaning: ${$list.find('option').length} options in list`);
19531952 $list.find('option').each(function () {
19541953 const $option = $(this);
19551954 $option.off();
19561955 $.cleanData([$option[0]]);
19571956 $option.remove();
19581957 });
1959- console.warn(`Post-clean: ${$list.find('option').length} options in list`);
19601958
19611959 // Step 2: Clean all <select> elements
1962- console.warn(`Before cleaning: ${$list.find('select').length} selects in list`);
19631960 $list.find('select').each(function () {
19641961 const $select = $(this);
19651962 // Remove Select2-related data and container if present
@@ -1967,7 +1964,7 @@ function clearEntryList() {
19671964 try {
19681965 $select.select2('destroy');
19691966 } catch (e) {
19701967 console.warndebug('Select2 destroy failed:', e);
19711968 }
19721969 }
19731970 const $container = $select.parent();
@@ -1975,47 +1972,34 @@ function clearEntryList() {
19751972 $container.find('*').off();
19761973 $.cleanData($container.find('*').get());
19771974 $container.remove();
1978- } else {
1979- console.warn('container not found');
1980- console.warn($select.parent().html());
19811975 }
1982- // Destroy Select2 if applicable
19831976
19841977 $select.off();
19851978 $.cleanData([$select[0]]);
19861979
19871980 });
1988- console.warn(`Post-clean: ${$list.find('select').length} selects in list`);
19891981
19901982 // Step 3: Clean <div>, <span>, <input>
1991- console.warn(`Before cleaning: ${$list.find('div, span, input').length} divs, spans, inputs in list`);
19921983 $list.find('div, span, input').each(function () {
19931984 const $elem = $(this);
19941985 $elem.off();
19951986 $.cleanData([$elem[0]]);
19961987 $elem.remove();
19971988 });
1998- console.warn(`Post-clean: ${$list.find('div, span, input').length} divs, spans, inputs in list`);
19991989
20001990 // Destroy Sortable
2001- console.warn(`Before cleaning: ${$list.sortable('instance') ? 1 : 0} sortable instance in list`);
20021991 if ($list.sortable('instance')) {
20031992 $list.sortable('destroy');
20041993 }
2005- console.warn(`Post-cleaning: ${$list.sortable('instance') ? 1 : 0} sortable instance in list`);
20061994
20071995 let totalElementsOfanyKindLeftInList = $list.children().length;
20081996
20091997 // Final cleanup
20101998 if (totalElementsOfanyKindLeftInList !== 0) {
20111999 console.time('empty');
2012- console.warn(`Before .empty(): ${totalElementsOfanyKindLeftInList} elements left in list`);
20132000 $list.empty();
20142001 totalElementsOfanyKindLeftInList = $list.children().length;
2015- console.warn(`After .empty(): ${totalElementsOfanyKindLeftInList} elements left in list`);
20162002 console.timeEnd('empty');
2017- } else {
2018- console.warn('Entry List is already totally empty, no need to call .empty()');
20192003 }
20202004
20212005 console.timeEnd('clearEntryList');