From c2316edc3ae091e2cd5a1a8ead2ab5b7b2ebd36a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 23 Feb 2020 08:56:44 +0000 Subject: [PATCH] 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 --- src/js/_enqueues/wp/media/editor.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/_enqueues/wp/media/editor.js b/src/js/_enqueues/wp/media/editor.js index a02ecf9376..b74780d928 100644 --- a/src/js/_enqueues/wp/media/editor.js +++ b/src/js/_enqueues/wp/media/editor.js @@ -164,8 +164,9 @@ var shortcode, html, extension; props = wp.media.string.props( props, attachment ); - if ( props.link !== 'embed' ) + if ( props.link !== 'embed' ) { return wp.media.string.link( props ); + } shortcode = {}; @@ -446,7 +447,7 @@ if ( attrs._orderbyRandom ) { attrs.orderby = 'rand'; - } else if ( attrs._orderByField && attrs._orderByField != 'rand' ) { + } else if ( attrs._orderByField && 'rand' !== attrs._orderByField ) { attrs.orderby = attrs._orderByField; } @@ -625,7 +626,7 @@ thumbnail_id: settings.post.featuredImageId, _wpnonce: settings.post.nonce }).done( function( html ) { - if ( html == '0' ) { + if ( '0' === html ) { window.alert( window.setPostThumbnailL10n.error ); return; } @@ -801,8 +802,9 @@ selection = selection || state.get('selection'); - if ( ! selection ) + if ( ! selection ) { return; + } $.when.apply( $, selection.map( function( attachment ) { var display = state.display( attachment ).toJSON(); @@ -965,8 +967,9 @@ size: 'image-size', alt: 'image_alt' }, function( option, prop ) { - if ( props[ prop ] ) + if ( props[ prop ] ) { options[ option ] = props[ prop ]; + } }); } else if ( 'video' === attachment.type ) { html = wp.media.string.video( props, attachment );