Fix sentry error in filter.js

Fix a sentry error caused by recent `filter.js` update.

Calling `getAttribute` if the element doesn't exist causes a silent failure so doesn't return the `init` function on pages without filters, leading to an error.