Replace deprecated jQuery.size() method