-
Notifications
You must be signed in to change notification settings - Fork 47
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
Melissa : Edges : Trek #36
base: master
Are you sure you want to change the base?
Conversation
TREKWhat We're Looking For
Nicely done on this project, Melissa! I'm really happy with how the code looks-- incredibly clean, readable, logical, and practical! It's a great project submission. I have a few nuanced comments on how you approached the event delegation, but otherwise I'm really pleased with the code. Really great work! |
reportStatus(`Successfully loaded ${response.data.length} trips`); | ||
// sort | ||
response.data.forEach((trip) => { | ||
tripList.append(`<li><a href='#' class="trip_id" id=${trip.id}>${trip.name}</li>`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably not include the `href='#' bit, otherwise it changes the URL of the browser
also instead of setting trip.id
to be the value of id
, you could probably set it to an attribute like data-id
instead
|
||
$('body').on('click', '.trip_id', function(event){ | ||
loadTripDetails(event.target.id); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice use of Event Delegation. I personally would've preferred if the selectors were more specific (instead of selecting on body
you waiting until showing the #trip-list
and selecting that) (or also, changing the name of the class of trip_id
since that's not really accurate for what those elements are), but it works all the same!
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
Trip
in the list by it's ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.