Make WordPress Core

Changeset 43556


Ignore:
Timestamp:
08/06/2018 07:32:12 PM (6 years ago)
Author:
obenland
Message:

Toolbar: Check if obj is set before using it.

Props pento.
See #44526.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/admin-bar.js

    r43517 r43556  
    304304         */
    305305        var addEvent = function( obj, type, fn ) {
    306             if ( typeof obj.addEventListener === 'function' ) {
     306            if ( obj && typeof obj.addEventListener === 'function' ) {
    307307                obj.addEventListener( type, fn, false );
    308             } else if ( typeof obj.attachEvent === 'function' ) {
     308            } else if ( obj && typeof obj.attachEvent === 'function' ) {
    309309                obj.attachEvent( 'on' + type, function() {
    310310                    return fn.call( obj, window.event );
Note: See TracChangeset for help on using the changeset viewer.