Stunkymonkey / hidaya

MediaElch-theme
5 stars 2 forks source link

js: Fix global variable, use strict mode #2

Closed bugwelle closed 4 years ago

bugwelle commented 4 years ago

'use strict' should always be used. It is JavaScript's strict mode. listing_div was a global variable, likely by accident.


I'd like to get these changes into the next hidaya version if possible. :-) Then I'll add it to MediaElch's meta repository.

Note: You could also use const/let instead of var. After all you're using CSS functions that are only supported by modern browsers so you could use modern JavaScript as well. ;)

Stunkymonkey commented 4 years ago

thanks :+1:

did not know about strict mode. I will fix the linting issues in the next commits

bugwelle commented 4 years ago

Strict mode isn't very useful for small scripts like yours but it doesn't hurt either. :-) See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode