From 3c97cbca24bfdc2ae53651e95ead23173655e934 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 31 Oct 2016 06:16:15 +0000 Subject: [PATCH] Themes: Exit `wp-custom-header.js` early in browsers wihout modern events. Adds a check for `window.addEventListener` support before attempting to use it. In browsers without support, the file is exited early to avoid throwing a JavaScript error. Fixes #38585. git-svn-id: https://develop.svn.wordpress.org/trunk@39050 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/wp-custom-header.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/js/wp-custom-header.js b/src/wp-includes/js/wp-custom-header.js index 80e00e5a74..80ebd917dc 100644 --- a/src/wp-includes/js/wp-custom-header.js +++ b/src/wp-includes/js/wp-custom-header.js @@ -1,5 +1,10 @@ (function( window, $, settings ) { + if ( ! ( 'addEventListener' in window ) ) { + // Fail gracefully in unsupported browsers. + return; + } + function wpCustomHeader() { var handlers = { nativeVideo: {