Web-Dev-For-Beginners icon indicating copy to clipboard operation
Web-Dev-For-Beginners copied to clipboard

typinggame_solution_index.js

Open shivamdroidoreo opened this issue 1 year ago • 3 comments

Issues found: Child node selection issue: The code is using quoteElement.childNodes[0] and quoteElement.childNodes[wordIndex]. The childNodes property includes all nodes, such as text nodes, which can interfere with the correct selection of elements.

Solution: Use children instead of childNodes, as children only selects element nodes and excludes text nodes.

Handling case when the last word is typed correctly: In the current implementation, after the last word is typed, the code does not reset for a new round or disable further input to prevent errors.

UI elements might not exist: There's no check to ensure that the quoteElement, messageElement, and typedValueElement exist in the DOM before trying to manipulate them. If these elements are missing, it could cause runtime errors.

Unnecessary word space in spans: There's an extra space (" " after each word in the span element generation), which may lead to display issues when highlighting words.

shivamdroidoreo avatar Oct 02 '24 09:10 shivamdroidoreo

Can you provide some screenshots related to the issue.

rajneesh-18 avatar Oct 17 '24 09:10 rajneesh-18

Hey @shivamdroidoreo , I’m new to open source and have resolved the issues mentioned, including child node selection, last word handling, UI element existence checks, and removing extra spaces in span elements. Could you please review the changes when you have a moment? Thank you!

saikishoreMSK avatar Oct 29 '24 08:10 saikishoreMSK

This issue has not seen any action for a while! Closing for now, but it can be reopened at a later date.

github-actions[bot] avatar Dec 28 '24 08:12 github-actions[bot]