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
This commit is contained in:
Peter Wilson 2016-10-31 06:16:15 +00:00
parent 4d115e4875
commit 3c97cbca24
1 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,10 @@
(function( window, $, settings ) {
if ( ! ( 'addEventListener' in window ) ) {
// Fail gracefully in unsupported browsers.
return;
}
function wpCustomHeader() {
var handlers = {
nativeVideo: {