Refactory: code style
This commit is contained in:
parent
d1dc5f8c20
commit
c4a7e19534
|
@ -447,32 +447,32 @@ jQuery( function( $ ) {
|
|||
* @return {Object}
|
||||
*/
|
||||
get_variations_fields: function( fields ) {
|
||||
|
||||
|
||||
var data = {};
|
||||
|
||||
$( ':input', fields ).each( function(index, elem) {
|
||||
|
||||
var $input = $(elem);
|
||||
|
||||
|
||||
$( ':input', fields ).each( function( index, elem ) {
|
||||
|
||||
var $input = $( elem );
|
||||
|
||||
// Bypass inputs without name att
|
||||
if (!elem.name) {
|
||||
if ( ! elem.name ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Bypass non-checked checkboxes and radio buttons.
|
||||
if (($input.is(':radio') || $input.is(':checkbox')) && !$input.is(':checked')) {
|
||||
if ( ( $input.is( ':radio' ) || $input.is( ':checkbox' ) ) && ! $input.is( ':checked' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Bypass disabled fields.
|
||||
if (true === $input.prop('disabled')) {
|
||||
if ( true === $input.prop( 'disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
data[elem.name] = elem.value;
|
||||
|
||||
|
||||
data[ elem.name ] = elem.value;
|
||||
|
||||
});
|
||||
|
||||
|
||||
$( '.variations-defaults select' ).each( function( index, element ) {
|
||||
var select = $( element );
|
||||
data[ select.attr( 'name' ) ] = select.val();
|
||||
|
|
Loading…
Reference in New Issue