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

View File

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