diff --git a/src/js/_enqueues/lib/admin-bar.js b/src/js/_enqueues/lib/admin-bar.js index 005bdbe096..6b3b8029a9 100644 --- a/src/js/_enqueues/lib/admin-bar.js +++ b/src/js/_enqueues/lib/admin-bar.js @@ -303,9 +303,9 @@ if ( typeof(jQuery) != 'undefined' ) { * @return {void} */ var addEvent = function( obj, type, fn ) { - if ( typeof obj.addEventListener === 'function' ) { + if ( obj && typeof obj.addEventListener === 'function' ) { obj.addEventListener( type, fn, false ); - } else if ( typeof obj.attachEvent === 'function' ) { + } else if ( obj && typeof obj.attachEvent === 'function' ) { obj.attachEvent( 'on' + type, function() { return fn.call( obj, window.event ); } );