Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Vue.js Basics Sweeping Vues: Loops, Methods, Directives Events: Toggling and Filtering

Olga Isakova
Olga Isakova
5,349 Points

Note on event handling in Firefox

Hi,

Treasure said that we don't have to specify the event argument in the filterList method definition. This is true in Chrome, however, in Firefox it will result in a ReferenceError. Please correct me if I'm wrong, but we should add the argument in order for the code to work in Firefox:

filterList = function(event) {...}

See explanation here

Note that we don't need to add event in the v-on directive:

<select v-on:change="filterList">

Here, filterList(event) would result in another ReferenceError, as there is no event variable in the current scope.

P.S. Thanks for the fun and engaging course, Treasure Porth , you are an awesome teacher!

Awesome

Steven Ventimiglia
Steven Ventimiglia
27,371 Points

Glad to see that someone posted this before I did. Future course material for Vue.js should define this as a necessary step to take for browser cross-compatibility - not to mention that it's a fundamental rule for handling events in Vanilla JS.

2 Answers

Treasure Porth
STAFF
Treasure Porth
Treehouse Teacher

Thanks for this, Olga! I've added this info to the Teacher's Notes for this video.

So happy to hear you enjoyed the course :D

Ross Horak
Ross Horak
20,890 Points

Also worth noting how to go about passing an argument to our v-on directive as well as still having access to the event object. Perhaps this will be good to include in teachers notes as well?

This stack overflow thread explains the problem and solution clearly: https://stackoverflow.com/questions/40956671/passing-event-and-argument-to-v-on-in-vue-js