Skip to content

add task solution#1875

Open
Roma-Yamshchikov wants to merge 2 commits into
mate-academy:masterfrom
Roma-Yamshchikov:develop
Open

add task solution#1875
Roma-Yamshchikov wants to merge 2 commits into
mate-academy:masterfrom
Roma-Yamshchikov:develop

Conversation

@Roma-Yamshchikov
Copy link
Copy Markdown

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

The implementation achieves the functional goal (labels are created and placed near inputs), but violates two explicit requirements from the task description. First, step 1 specifies getting inputs from the form element, but the code uses document.querySelectorAll('input') which selects all inputs on the page globally. Use document.querySelector('form').querySelectorAll('input') or document.querySelectorAll('form input') instead. Second, step 4 explicitly states to 'append' labels to the parent container, but the code uses item.before() which inserts as a sibling before the input rather than appending to the parent. Use item.parentElement.appendChild(label) instead. While the current approach works, following the specified methodology is important for consistency and maintainability.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js Outdated
'use strict';

// write code here
const input = [...document.querySelectorAll('input')];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirement specifies getting inputs FROM the form tag. Currently selecting all input elements on the page. Consider using document.querySelector('form').querySelectorAll('input') or document.querySelectorAll('form input').

Comment thread src/scripts/main.js Outdated
label.classList.add('field-label');
label.setAttribute('for', item.id);
label.textContent = item.getAttribute('name');
item.before(label);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 4 of the requirements states to 'Append label elements to the parent container of input'. Using item.before() inserts the label as a sibling before the input. Consider using item.parentElement.appendChild(label) instead to properly append to the parent container.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation successfully meets all requirements. The code correctly selects inputs from the form element, creates labels with the field-label class, sets the for attribute to match input IDs, populates label textContent and placeholders with properly capitalized input names, and appends labels to parent containers. All requirements from the checklist are satisfied, including handling steps 2 and 4 in a single loop iteration. No issues or test failures were identified.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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

Successfully merging this pull request may close these issues.

2 participants