task solution#1754
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| const largeImg = document.querySelector('#largeImg'); | ||
|
|
||
| document.querySelector('#thumbs').addEventListener('click', function (e) { | ||
| const link = event.target.closest('a'); |
There was a problem hiding this comment.
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.
| if (!link) { | ||
| return; | ||
| } | ||
| event.preventDefault(); |
There was a problem hiding this comment.
Same inconsistency: use e.preventDefault() instead of event.preventDefault().
No description provided.