Javascript

The COUNTRY Financial javascript library is built using vanilla JavaScript with no external dependencies such as jQuery.  This helps keep our JavaScript lightweight and also forces us to focus heavily on each section of our components to ensure code reliability and maintainability.

We use a revealing modular pattern when building our JavaScript components.  This pattern gives us full control on the methods and variables that we want to expose that can eventually be used by other components that we build down the road.  For more information about the revealing modular pattern, check out the LearnCode.academy video series on object literal patterns.

When targeting HTML with your JavaScript, be sure to prefix all of your HTML classes with js-[your class name]. This helps keep our JavaScript classes and CSS classes separated so we don't run into conflicts with we build modules in the future.  Never style a js- class name in your CSS, and never target a regular CSS class name in your JavaScript