@@ -269,8 +269,8 @@ function initBubbleSort() {
269269 const arr = Array . from ( { length : 8 } , ( ) => Math . floor ( Math . random ( ) * 90 ) + 10 ) ;
270270 input . value = arr . join ( ' ' ) ;
271271 renderBars ( arr ) ;
272- resultDiv . textContent = '' ;
273- statsDiv . textContent = '' ;
272+ resultDiv . innerHTML = '' ;
273+ statsDiv . innerHTML = '' ;
274274 } ) ;
275275
276276 function sleep ( ms ) {
@@ -354,31 +354,31 @@ function initBubbleSort() {
354354
355355 const raw = input . value . trim ( ) ;
356356 if ( ! raw ) {
357- resultDiv . textContent = `<p style="color:var(--danger-color)">⚠️ Please enter numbers!</p>` ;
357+ resultDiv . innerHTML = `<p style="color:var(--danger-color)">⚠️ Please enter numbers!</p>` ;
358358 return ;
359359 }
360360
361361 const arr = raw . split ( / \s + / ) . map ( Number ) ;
362362 if ( arr . some ( isNaN ) ) {
363- resultDiv . textContent = `<p style="color:var(--danger-color)">⚠️ Please enter valid integers only!</p>` ;
363+ resultDiv . innerHTML = `<p style="color:var(--danger-color)">⚠️ Please enter valid integers only!</p>` ;
364364 return ;
365365 }
366366
367367 if ( arr . length < 2 ) {
368- resultDiv . textContent = `<p style="color:var(--danger-color)">⚠️ Enter at least 2 numbers!</p>` ;
368+ resultDiv . innerHTML = `<p style="color:var(--danger-color)">⚠️ Enter at least 2 numbers!</p>` ;
369369 return ;
370370 }
371371
372372 isSorting = true ;
373373 comparisons = 0 ;
374374 swaps = 0 ;
375375 startBtn . disabled = true ;
376- resultDiv . textContent = `<p style="color:var(--text-secondary)">⏳ Sorting...</p>` ;
376+ resultDiv . innerHTML = `<p style="color:var(--text-secondary)">⏳ Sorting...</p>` ;
377377
378378 renderBars ( [ ...arr ] ) ;
379379 const sorted = await bubbleSortVisualize ( [ ...arr ] ) ;
380380
381- resultDiv . textContent = `
381+ resultDiv . innerHTML = `
382382 <p style="color:var(--success-color); font-weight:700; font-size:1.2rem">
383383 ✅ Sorted: [ ${ sorted . join ( ', ' ) } ]
384384 </p>
0 commit comments