diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index 38bf6004..2c4edf98 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -9,6 +9,27 @@ This guide will help you upgrade your codebase. TBD +## Use `DOMContentLoaded` event instead of `load` + +It is highly recommended changing the event where plugin initialization is placed to `DOMContentLoaded`: + +```diff + +``` + +This will lead to a faster start and rendering of the cookie consent, because unlike `load`, the `DOMContentLoaded` +event (see [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event)) does not wait +for loading of other page resources (like images). + +When loading the plugin from a standalone file or CDN, you should keep using the `defer` attribute of `