File tree Expand file tree Collapse file tree 4 files changed +7
-9
lines changed
vanilla/guess-the-word/src Expand file tree Collapse file tree 4 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,7 @@ export function handleDifficultyComplete() {
3333 import ( "@/ui/insane-countdown-bar" ) . then ( ( { hideInsaneCountdown } ) =>
3434 hideInsaneCountdown ( ) ,
3535 ) ;
36- // TODO: use a while loop
37- $typing . replaceChildren ( ) ;
36+ while ( $typing . firstChild != null ) $typing . removeChild ( $typing . firstChild ) ;
3837 $typing . classList . add ( CLASSES . HIDDEN ) ;
3938
4039 showCompletedDifficultyMessage ( difficulty , { allCompleted : gameCompleted } ) ;
Original file line number Diff line number Diff line change 11import { $allHintsList , $correctHintsList } from "./elements" ;
22
33export const clearHints = ( ) => {
4- // TODO: use a while loop
5- $allHintsList . replaceChildren ( ) ;
6- $correctHintsList . replaceChildren ( ) ;
4+ while ( $allHintsList . firstChild != null )
5+ $allHintsList . removeChild ( $allHintsList . firstChild ) ;
6+ while ( $correctHintsList . firstChild != null )
7+ $correctHintsList . removeChild ( $correctHintsList . firstChild ) ;
78} ;
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ const $letterFields = [];
1212/** @param {number } quantity */
1313export function createLetterFields ( quantity ) {
1414 $letterFields . length = 0 ;
15- // TODO: use a while loop
16- $typing . replaceChildren ( ) ;
15+ while ( $typing . firstChild != null ) $typing . removeChild ( $typing . firstChild ) ;
1716
1817 for ( let idx = 0 ; idx < quantity ; idx ++ ) {
1918 const $letterClone = /** @type {DocumentFragment } */ (
Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ const lettersToUse = [""];
1515
1616/** @param {string } word */
1717export const createWordLetters = ( word ) => {
18- // TODO: use a while loop
19- $word . replaceChildren ( ) ;
18+ while ( $word . firstChild != null ) $word . removeChild ( $word . firstChild ) ;
2019 $wordLetters . length = 0 ;
2120 lettersToUse . length = 0 ;
2221
You can’t perform that action at this time.
0 commit comments