From d9ef1ad66d9e3a8e7a7387e050e322bdde018ced Mon Sep 17 00:00:00 2001 From: Nicholas Ray Date: Mon, 10 Jan 2022 13:34:01 -0700 Subject: [PATCH] Fix TypeError: document.querySelectorAll(...).forEach is not a function Bug: T298910 Change-Id: Iaa67f36278af7805c5d915737d6b30e98b3f8484 --- resources/skins.vector.js/dropdownMenus.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/skins.vector.js/dropdownMenus.js b/resources/skins.vector.js/dropdownMenus.js index 9363f15..05bf309 100644 --- a/resources/skins.vector.js/dropdownMenus.js +++ b/resources/skins.vector.js/dropdownMenus.js @@ -35,10 +35,10 @@ function bind() { */ function bindCloseOnUnload() { addEventListener( 'beforeunload', function () { - document.querySelectorAll( CHECKBOX_HACK_CHECKBOX_SELECTOR + ':checked' ) - .forEach( function ( checkbox ) { - /** @type {HTMLInputElement} */ ( checkbox ).checked = false; - } ); + var checkboxes = document.querySelectorAll( CHECKBOX_HACK_CHECKBOX_SELECTOR + ':checked' ); + Array.prototype.forEach.call( checkboxes, function ( checkbox ) { + /** @type {HTMLInputElement} */ ( checkbox ).checked = false; + } ); } ); }