Optimization: Don't use $.size(), use native Object.length instead.

This commit is contained in:
George Stephanis 2015-08-07 15:24:35 -04:00
parent 516977bd01
commit 94618db86a
1 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@
});
$('.wc_tax_rates .remove_tax_rates').click(function() {
if ( $tbody.find('tr.current').size() > 0 ) {
if ( $tbody.find('tr.current').length > 0 ) {
var $current = $tbody.find('tr.current');
$current.find('input').val('');
$current.find('input.remove_tax_rate').val('1');
@ -67,7 +67,7 @@
});
$('.wc_tax_rates .insert').click(function() {
var size = $tbody.find('tr').size();
var size = $tbody.find('tr').length;
var code = wp.template( 'wc-tax-table-row' )( {
tax_rate_id : 'new-' + size,
tax_rate_priority : 1,
@ -75,7 +75,7 @@
newRow : true
} );
if ( $tbody.find('tr.current').size() > 0 ) {
if ( $tbody.find('tr.current').length > 0 ) {
$tbody.find('tr.current').after( code );
} else {
$tbody.append( code );