From a8c8ed3b94947ccd2a15340d9093debb9086b584 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 27 Feb 2014 20:10:32 +0000 Subject: [PATCH] In `media-editor.js`, use `_.isUndefined()` when available. See #26631. git-svn-id: https://develop.svn.wordpress.org/trunk@27317 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-editor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/js/media-editor.js b/src/wp-includes/js/media-editor.js index db090746c8..36fb899fac 100644 --- a/src/wp-includes/js/media-editor.js +++ b/src/wp-includes/js/media-editor.js @@ -212,7 +212,7 @@ props = wp.media.string.props( props, attachment ); classes = props.classes || []; - img.src = typeof attachment !== 'undefined' ? attachment.url : props.url; + img.src = ! _.isUndefined( attachment ) ? attachment.url : props.url; _.extend( img, _.pick( props, 'width', 'height', 'alt' ) ); // Only assign the align class to the image if we're not printing @@ -279,7 +279,7 @@ return _.extend( attributes, { coerce: function ( attrs, key ) { - if ( 'undefined' === typeof attrs[ key ] && 'undefined' !== typeof this.defaults[ key ] ) { + if ( _.isUndefined( attrs[ key ] ) && ! _.isUndefined( this.defaults[ key ] ) ) { attrs[ key ] = this.defaults[ key ]; } else if ( 'true' === attrs[ key ] ) { attrs[ key ] = true; @@ -632,8 +632,8 @@ */ insert: function( html ) { var editor, - hasTinymce = typeof tinymce !== 'undefined', - hasQuicktags = typeof QTags !== 'undefined', + hasTinymce = ! _.isUndefined( tinymce ), + hasQuicktags = ! _.isUndefined( QTags ), wpActiveEditor = window.wpActiveEditor; // Delegate to the global `send_to_editor` if it exists. @@ -798,7 +798,7 @@ id = wpActiveEditor; // If that doesn't work, fall back to `tinymce.activeEditor.id`. - if ( ! id && typeof tinymce !== 'undefined' && tinymce.activeEditor ) { + if ( ! id && ! _.isUndefined( tinymce ) && tinymce.activeEditor ) { id = tinymce.activeEditor.id; } @@ -929,7 +929,7 @@ id = this.id( id ); /* // Save a bookmark of the caret position in IE. - if ( typeof tinymce !== 'undefined' ) { + if ( ! _.isUndefined( tinymce ) ) { editor = tinymce.get( id ); if ( tinymce.isIE && editor && ! editor.isHidden() ) {