Coding Standards: Add missing braces to if conditions and use strict comparison in js/_enqueues/wp/media/editor.js.

Props ankitmaru.
Fixes #49317.

git-svn-id: https://develop.svn.wordpress.org/trunk@47349 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-02-23 08:56:44 +00:00
parent dd859e48f2
commit c2316edc3a

View File

@ -164,8 +164,9 @@
var shortcode, html, extension; var shortcode, html, extension;
props = wp.media.string.props( props, attachment ); props = wp.media.string.props( props, attachment );
if ( props.link !== 'embed' ) if ( props.link !== 'embed' ) {
return wp.media.string.link( props ); return wp.media.string.link( props );
}
shortcode = {}; shortcode = {};
@ -446,7 +447,7 @@
if ( attrs._orderbyRandom ) { if ( attrs._orderbyRandom ) {
attrs.orderby = 'rand'; attrs.orderby = 'rand';
} else if ( attrs._orderByField && attrs._orderByField != 'rand' ) { } else if ( attrs._orderByField && 'rand' !== attrs._orderByField ) {
attrs.orderby = attrs._orderByField; attrs.orderby = attrs._orderByField;
} }
@ -625,7 +626,7 @@
thumbnail_id: settings.post.featuredImageId, thumbnail_id: settings.post.featuredImageId,
_wpnonce: settings.post.nonce _wpnonce: settings.post.nonce
}).done( function( html ) { }).done( function( html ) {
if ( html == '0' ) { if ( '0' === html ) {
window.alert( window.setPostThumbnailL10n.error ); window.alert( window.setPostThumbnailL10n.error );
return; return;
} }
@ -801,8 +802,9 @@
selection = selection || state.get('selection'); selection = selection || state.get('selection');
if ( ! selection ) if ( ! selection ) {
return; return;
}
$.when.apply( $, selection.map( function( attachment ) { $.when.apply( $, selection.map( function( attachment ) {
var display = state.display( attachment ).toJSON(); var display = state.display( attachment ).toJSON();
@ -965,8 +967,9 @@
size: 'image-size', size: 'image-size',
alt: 'image_alt' alt: 'image_alt'
}, function( option, prop ) { }, function( option, prop ) {
if ( props[ prop ] ) if ( props[ prop ] ) {
options[ option ] = props[ prop ]; options[ option ] = props[ prop ];
}
}); });
} else if ( 'video' === attachment.type ) { } else if ( 'video' === attachment.type ) {
html = wp.media.string.video( props, attachment ); html = wp.media.string.video( props, attachment );