-
Notifications
You must be signed in to change notification settings - Fork 868
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
Throw causes entire script to exit if selected blocks don't exist #68
Comments
@mattclough1 Can you instantiate rellax only on the pages you need? |
@moeamaya yeah, I just went ahead and checked whether the element was available before instantiating... depending on how someone is using Rellax, an exception is probably appropriate. In my case it's embellishment. Disregard! 😅 |
Hey I know how it goes when you're trying to ship your site, so no worries. I think i am going to keep the |
Similar issue without bundling |
@moeamaya Respectfully, I disagree with throwing an exception. Rellax is a nice to have and typically isn't required for the page to work so throwing an exception and stopping the entire script from executing doesn't make sense to me. Rellax should definitely not run if no elements exist, but I don't believe stopping other JS from running is right. I think throwing a warning instead would be more appropriate. |
@KeironLowe How dare you say Rellax is "a nice to have" it's as critical as babel 😜 But okay I hear you all, and I recant my original position. If anyone wants to make a PR happy to merge without the blocking exception. |
@moeamaya Some would say even more critical! Thanks, I've just submitted a PR. |
rellax/rellax.js
Line 95 in f3099f9
Is this intentional behavior? I can't help but feel like maybe it should just
console.warn
and return. In my case, the module is included in bundle, and since some pages don't have the selected elements, it causes all the JS to exit.The text was updated successfully, but these errors were encountered: