JavaScript
Guidelines for JavaScript usage.
General
Websites should be built with as little javascript as possible. (Exception: SPA Framework like vue.js).
Website should use no external javascript libraries (except SPA Frameworks like vue.js). We try to minimize the external dependencies because this may cause a security risk or increase the long term costs to maintain this dependencies.
Please check the list of approved JavaScript frameworks.
If you should need additional javascript libraries for your implementation, please contact at first Sandra.Brandstaetter@egger.com and ask for permission. Once approved, the JavaScript library is installed on the EGGER JavaScript CDN: https://js.egger-cdn.com/
You MUST NOT use any JavaScripts from external Servers/CDN. (No cloudflare CDN or Google CDN or jsdeliver)
Page layout
The layout of a page MUST function entirely without javascript - including the responsiveness of the page. There MUST be no difference between the page when viewed with javascript enabled or javascript disabled.
User Interactions can trigger javascript functions. e.g. open an overlay or go to the next image of an image gallery slider
JavaScript Events
There MUST be no javascript function registered on events that affect page rendering.
window.addEventListener('resize', XXX);document.addEventListener('scroll', XXX);- etc.
Exception: If the developer got permission to use a javascript library where events cannot be disabled.
Exception: Sticky elements. If the design uses elements which are displayed at a fixed position if the user reaches a certain scroll position, the scroll event can be used. e.g. sticky navigation bar. See reference implementation
Animations
Animations should be implemented with CSS or be removed completely.