Skip to content

task solution#1754

Open
vectormeleshko wants to merge 1 commit intomate-academy:masterfrom
vectormeleshko:master
Open

task solution#1754
vectormeleshko wants to merge 1 commit intomate-academy:masterfrom
vectormeleshko:master

Conversation

@vectormeleshko
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 is functionally correct and meets all core requirements. The gallery properly uses event delegation on the #thumbs container and correctly handles clicks on both img and a elements. The main image updates properly when thumbnails are clicked. The code works as expected in browsers, so I'm approving it. However, I'd encourage you to fix the minor inconsistency noted in review: use the parameter e consistently (e.g., e.target.closest('a') and e.preventDefault()) instead of the global event object. This is a best practice that will help you avoid issues in strict mode or with certain edge cases. Great work overall!


✨ 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
const largeImg = document.querySelector('#largeImg');

document.querySelector('#thumbs').addEventListener('click', function (e) {
const link = event.target.closest('a');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent variable usage: the function parameter is e but event (global) is used instead. Change to e.target.closest('a') for consistency with the parameter.

Comment thread src/scripts/main.js
if (!link) {
return;
}
event.preventDefault();
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 inconsistency: use e.preventDefault() instead of event.preventDefault().

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