File tree Expand file tree Collapse file tree 3 files changed +120
-103
lines changed
examples/Rock-Paper-Scissors Expand file tree Collapse file tree 3 files changed +120
-103
lines changed Original file line number Diff line number Diff line change @@ -48,21 +48,21 @@ <h3 id="computerChoiceText">Waiting...</h3>
4848 </ div >
4949
5050 < div class ="controls ">
51- < button type ="button " class ="choice-btn rock " id ="rockBtn " data-choice ="rock " aria-keyshortcuts ="R ">
51+ < button type ="button " class ="choice-btn rock " id ="rockBtn " data-choice ="rock " aria-keyshortcuts ="R " aria-label =" Select Rock (R) " >
5252 < span class ="emoji "> 🪨</ span >
5353 < span class ="label "> Rock</ span >
5454 </ button >
55- < button type ="button " class ="choice-btn paper " id ="paperBtn " data-choice ="paper " aria-keyshortcuts ="P ">
55+ < button type ="button " class ="choice-btn paper " id ="paperBtn " data-choice ="paper " aria-keyshortcuts ="P " aria-label =" Select Paper (P) " >
5656 < span class ="emoji "> 📄</ span >
5757 < span class ="label "> Paper</ span >
5858 </ button >
59- < button type ="button " class ="choice-btn scissors " id ="scissorsBtn " data-choice ="scissors " aria-keyshortcuts ="S ">
59+ < button type ="button " class ="choice-btn scissors " id ="scissorsBtn " data-choice ="scissors " aria-keyshortcuts ="S " aria-label =" Select Scissors (S) " >
6060 < span class ="emoji "> ✂️</ span >
6161 < span class ="label "> Scissors</ span >
6262 </ button >
6363 </ div >
6464
65- < button type ="button " class ="reset-btn " id ="resetBtn " aria-keyshortcuts ="X ">
65+ < button type ="button " class ="reset-btn " id ="resetBtn " aria-keyshortcuts ="X " aria-label =" Reset Game (X) " >
6666 < span class ="reset-icon "> 🔄</ span >
6767 Reset Game
6868 </ button >
@@ -71,7 +71,9 @@ <h3 id="computerChoiceText">Waiting...</h3>
7171 < div class ="round-history " id ="roundHistory ">
7272 < h3 > Round History</ h3 >
7373 < div class ="history-list " id ="historyList ">
74- < p class ="no-history "> No rounds played yet. Make your first move!</ p >
74+ < ul id ="historyUl ">
75+ < li class ="no-history "> No rounds played yet. Make your first move!</ li >
76+ </ ul >
7577 </ div >
7678 </ div >
7779 </ div >
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class RockPaperScissorsGame {
2525 this . paperBtn = document . getElementById ( 'paperBtn' ) ;
2626 this . scissorsBtn = document . getElementById ( 'scissorsBtn' ) ;
2727 this . resetBtn = document . getElementById ( 'resetBtn' ) ;
28- this . historyListEl = document . getElementById ( 'historyList ' ) ;
28+ this . historyListEl = document . getElementById ( 'historyUl ' ) ;
2929 }
3030
3131 bindEvents ( ) {
@@ -143,14 +143,14 @@ if (playerBtn) {
143143
144144 displayHistory ( ) {
145145 if ( this . gameHistory . length === 0 ) {
146- this . historyListEl . innerHTML = '<p class="no-history">No rounds played yet. Make your first move!</p >' ;
146+ this . historyListEl . innerHTML = '<li class="no-history">No rounds played yet. Make your first move!</li >' ;
147147 return ;
148148 }
149149
150150 this . historyListEl . innerHTML = '' ;
151151
152152 this . gameHistory . slice ( 0 , 10 ) . forEach ( item => {
153- const historyItemEl = document . createElement ( 'div ' ) ;
153+ const historyItemEl = document . createElement ( 'li ' ) ;
154154 historyItemEl . className = `history-item ${ item . result } ` ;
155155
156156 historyItemEl . innerHTML = `
You can’t perform that action at this time.
0 commit comments