Skip to content

Develop#1753

Open
YaroslavKra wants to merge 2 commits intomate-academy:masterfrom
YaroslavKra:develop
Open

Develop#1753
YaroslavKra wants to merge 2 commits intomate-academy:masterfrom
YaroslavKra:develop

Conversation

@YaroslavKra
Copy link
Copy Markdown

No description provided.

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 correctly uses event delegation on the #thumbs container and properly updates the main image source and alt text. The core functionality works as expected. The review makes a fair point about checking element types instead of class names. While your current approach works for the expected HTML structure (checking gallery__thumb and list-item__link classes), using target.tagName === 'IMG' or target.tagName === 'A' would be more robust and directly matches what the task describes: event.target will be "respectively, either img or a." This is a minor improvement rather than a functional issue—the code works correctly for the specified HTML, and this suggestion is offered as a "best practice" note for future reference. No changes are required at this time.


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

Footnotes

  1. Rate AI review example

Comment thread src/scripts/main.js

let link;

if (target.classList.contains('gallery__thumb')) {
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 task specifies that event.target will be an img or a element. Instead of checking class names, consider checking the element's tag name: target.tagName === 'IMG' for images or target.tagName === 'A' for links. This matches the actual task requirements.

Comment thread src/scripts/main.js

if (target.classList.contains('gallery__thumb')) {
link = target.closest('a');
} else if (target.classList.contains('list-item__link')) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue as line 11 - list-item__link is a specific class name that may not match the actual HTML. Consider checking target.tagName === 'A' instead.

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