diff options
author | Suzanne Selhorn <sselhorn@gitlab.com> | 2023-09-26 00:37:51 +0300 |
---|---|---|
committer | Suzanne Selhorn <sselhorn@gitlab.com> | 2023-09-26 00:37:51 +0300 |
commit | 934f8f72fc92e30bea17edb51527c93157ae0c61 (patch) | |
tree | dfdfc568492d9b1b44ed5a122e4f7fe4761f3fd8 | |
parent | 442f0055cb966e1cef3996ba7b9d0b2f8d20b18b (diff) | |
parent | 44c97ac66022d2c1f7bd4209ad59896f7735a397 (diff) |
Merge branch '1718-clippy-awol' into 'main'
Replace window.onLoad event listeners
Closes #1718
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/4278
Merged-by: Suzanne Selhorn <sselhorn@gitlab.com>
Co-authored-by: Sarah German <sgerman@gitlab.com>
-rw-r--r-- | content/frontend/default/badges.js | 4 | ||||
-rw-r--r-- | content/frontend/shared/clipboardjs.js | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/content/frontend/default/badges.js b/content/frontend/default/badges.js index 30ac76a6..90cbd11f 100644 --- a/content/frontend/default/badges.js +++ b/content/frontend/default/badges.js @@ -26,7 +26,7 @@ if (isContributorDocs()) { ' <span data-component="docs-badges" data-nosnippet><span data-type="content" data-value="contribute"></span></span>', ); } -window.onload = () => { +window.addEventListener('load', () => { document.querySelectorAll('[data-component="docs-badges"]').forEach((badgeSet) => { const badges = badgeSet.querySelectorAll('span'); @@ -49,4 +49,4 @@ window.onload = () => { }, }))(); }); -}; +}); diff --git a/content/frontend/shared/clipboardjs.js b/content/frontend/shared/clipboardjs.js index 51f8ed82..df207943 100644 --- a/content/frontend/shared/clipboardjs.js +++ b/content/frontend/shared/clipboardjs.js @@ -11,7 +11,7 @@ const createCopyButton = () => { return button; }; -window.onload = () => { +window.addEventListener('load', () => { document.querySelectorAll('pre').forEach((element) => { const button = createCopyButton(); element.appendChild(button); @@ -46,4 +46,4 @@ window.onload = () => { } }); }); -}; +}); |