Toolbar: Check if obj
is set before using it.
Props pento. See #44526. git-svn-id: https://develop.svn.wordpress.org/trunk@43556 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4ce3db3e8d
commit
c52e7c79b2
@ -303,9 +303,9 @@ if ( typeof(jQuery) != 'undefined' ) {
|
|||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
var addEvent = function( obj, type, fn ) {
|
var addEvent = function( obj, type, fn ) {
|
||||||
if ( typeof obj.addEventListener === 'function' ) {
|
if ( obj && typeof obj.addEventListener === 'function' ) {
|
||||||
obj.addEventListener( type, fn, false );
|
obj.addEventListener( type, fn, false );
|
||||||
} else if ( typeof obj.attachEvent === 'function' ) {
|
} else if ( obj && typeof obj.attachEvent === 'function' ) {
|
||||||
obj.attachEvent( 'on' + type, function() {
|
obj.attachEvent( 'on' + type, function() {
|
||||||
return fn.call( obj, window.event );
|
return fn.call( obj, window.event );
|
||||||
} );
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user