Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typinggame_solution_index.js #1346

Open
shivamdroidoreo opened this issue Oct 2, 2024 · 2 comments
Open

typinggame_solution_index.js #1346

shivamdroidoreo opened this issue Oct 2, 2024 · 2 comments

Comments

@shivamdroidoreo
Copy link

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.

@rajneesh-18
Copy link

Can you provide some screenshots related to the issue.

saikishoreMSK added a commit to saikishoreMSK/Web-Dev-For-Beginners that referenced this issue Oct 29, 2024
…removed unnecessary span spaces, and added element existence checks
@saikishoreMSK
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants