jQuery: Replace the use of the `.size()` method with the `.length` property.
The `.size()` method is deprecated since jQuery 1.8. The `.length` property is preferred because it doesn't have the overhead of a function call. See https://api.jquery.com/size/. See #35380. Built from https://develop.svn.wordpress.org/trunk@36286 git-svn-id: http://core.svn.wordpress.org/trunk@36253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b1a9983584
commit
b3d8732c17
|
@ -83,7 +83,7 @@ validateForm = function( form ) {
|
|||
.addClass( 'form-invalid' )
|
||||
.find( 'input:visible' )
|
||||
.change( function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
|
||||
.size();
|
||||
.length;
|
||||
};
|
||||
|
||||
// stub for doing better warnings
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -481,7 +481,7 @@ setCommentsList = function() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! theExtraList || theExtraList.size() === 0 || theExtraList.children().size() === 0 ) {
|
||||
if ( ! theExtraList || theExtraList.length === 0 || theExtraList.children().length === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -47,7 +47,7 @@ var tb_position;
|
|||
adminbar_height = parseInt( $('#wpadminbar').css('height'), 10 );
|
||||
}
|
||||
|
||||
if ( tbWindow.size() ) {
|
||||
if ( tbWindow.length ) {
|
||||
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
|
||||
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height );
|
||||
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'});
|
||||
|
|
|
@ -1 +1 @@
|
|||
var wpActiveEditor,send_to_editor;send_to_editor=function(a){var b,c="undefined"!=typeof tinymce,d="undefined"!=typeof QTags;if(wpActiveEditor)c&&(b=tinymce.get(wpActiveEditor));else if(c&&tinymce.activeEditor)b=tinymce.activeEditor,wpActiveEditor=b.id;else if(!d)return!1;if(b&&!b.isHidden()?b.execCommand("mceInsertContent",!1,a):d?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a,window.tb_remove)try{window.tb_remove()}catch(e){}};var tb_position;!function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>833?833:c,f=0;return a("#wpadminbar").length&&(f=parseInt(a("#wpadminbar").css("height"),10)),b.size()&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+(e-80)+"&height="+(d-85-f)))})},a(window).resize(function(){tb_position()})}(jQuery);
|
||||
var wpActiveEditor,send_to_editor;send_to_editor=function(a){var b,c="undefined"!=typeof tinymce,d="undefined"!=typeof QTags;if(wpActiveEditor)c&&(b=tinymce.get(wpActiveEditor));else if(c&&tinymce.activeEditor)b=tinymce.activeEditor,wpActiveEditor=b.id;else if(!d)return!1;if(b&&!b.isHidden()?b.execCommand("mceInsertContent",!1,a):d?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a,window.tb_remove)try{window.tb_remove()}catch(e){}};var tb_position;!function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height(),e=c>833?833:c,f=0;return a("#wpadminbar").length&&(f=parseInt(a("#wpadminbar").css("height"),10)),b.length&&(b.width(e-50).height(d-45-f),a("#TB_iframeContent").width(e-50).height(d-75-f),b.css({"margin-left":"-"+parseInt((e-50)/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:20+f+"px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+(e-80)+"&height="+(d-85-f)))})},a(window).resize(function(){tb_position()})}(jQuery);
|
|
@ -9,7 +9,7 @@ jQuery( document ).ready( function( $ ) {
|
|||
H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ),
|
||||
W = ( 792 < width ) ? 772 : width - 20;
|
||||
|
||||
if ( tbWindow.size() ) {
|
||||
if ( tbWindow.length ) {
|
||||
tbWindow.width( W ).height( H );
|
||||
$( '#TB_iframeContent' ).width( W ).height( H );
|
||||
tbWindow.css({
|
||||
|
|
|
@ -1 +1 @@
|
|||
var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height()-(c>792?60:20),e=c>792?772:c-20;return b.size()&&(b.width(e).height(d),a("#TB_iframeContent").width(e).height(d),b.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:"30px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+e+"&height="+d))})},a(window).resize(function(){tb_position()}),a(".plugin-card, .plugins .plugin-version-author-uri").on("click","a.thickbox",function(b){b.preventDefault(),b.stopPropagation(),tb_click.call(this),a("#TB_title").css({"background-color":"#23282d",color:"#cfcfcf"}),a("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong> "+a(this).data("title")),a("#TB_iframeContent").attr("title",plugininstallL10n.plugin_information+" "+a(this).data("title")),a("#TB_closeWindowButton").focus()}),a("#plugin-information-tabs a").click(function(b){var c=a(this).attr("name");b.preventDefault(),a("#plugin-information-tabs a.current").removeClass("current"),a(this).addClass("current"),"description"!==c&&a(window).width()<772?a("#plugin-information-content").find(".fyi").hide():a("#plugin-information-content").find(".fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()})});
|
||||
var tb_position;jQuery(document).ready(function(a){tb_position=function(){var b=a("#TB_window"),c=a(window).width(),d=a(window).height()-(c>792?60:20),e=c>792?772:c-20;return b.length&&(b.width(e).height(d),a("#TB_iframeContent").width(e).height(d),b.css({"margin-left":"-"+parseInt(e/2,10)+"px"}),"undefined"!=typeof document.body.style.maxWidth&&b.css({top:"30px","margin-top":"0"})),a("a.thickbox").each(function(){var b=a(this).attr("href");b&&(b=b.replace(/&width=[0-9]+/g,""),b=b.replace(/&height=[0-9]+/g,""),a(this).attr("href",b+"&width="+e+"&height="+d))})},a(window).resize(function(){tb_position()}),a(".plugin-card, .plugins .plugin-version-author-uri").on("click","a.thickbox",function(b){b.preventDefault(),b.stopPropagation(),tb_click.call(this),a("#TB_title").css({"background-color":"#23282d",color:"#cfcfcf"}),a("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong> "+a(this).data("title")),a("#TB_iframeContent").attr("title",plugininstallL10n.plugin_information+" "+a(this).data("title")),a("#TB_closeWindowButton").focus()}),a("#plugin-information-tabs a").click(function(b){var c=a(this).attr("name");b.preventDefault(),a("#plugin-information-tabs a.current").removeClass("current"),a(this).addClass("current"),"description"!==c&&a(window).width()<772?a("#plugin-information-content").find(".fyi").hide():a("#plugin-information-content").find(".fyi").show(),a("#section-holder div.section").hide(),a("#section-"+c).show()})});
|
|
@ -73,7 +73,7 @@ WPSetThumbnailHTML = function(html){
|
|||
|
||||
WPSetThumbnailID = function(id){
|
||||
var field = $('input[value="_thumbnail_id"]', '#list-table');
|
||||
if ( field.size() > 0 ) {
|
||||
if ( field.length > 0 ) {
|
||||
$('#meta\\[' + field.attr('id').match(/[0-9]+/) + '\\]\\[value\\]').text(id);
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,7 +24,7 @@ var wpAjax = jQuery.extend( {
|
|||
response.supplemental = {};
|
||||
if ( !jQuery( 'supplemental', child ).children().each( function() {
|
||||
response.supplemental[this.nodeName] = jQuery(this).text();
|
||||
} ).size() ) { response.supplemental = false; }
|
||||
} ).length ) { response.supplemental = false; }
|
||||
response.errors = [];
|
||||
if ( !jQuery('wp_error', child).each( function() {
|
||||
var code = jQuery(this).attr('code'), anError, errorData, formField;
|
||||
|
@ -37,7 +37,7 @@ var wpAjax = jQuery.extend( {
|
|||
err += '<p>' + anError.message + '</p>';
|
||||
response.errors.push( anError );
|
||||
parsed.errors = true;
|
||||
} ).size() ) { response.errors = false; }
|
||||
} ).length ) { response.errors = false; }
|
||||
parsed.responses.push( response );
|
||||
} );
|
||||
if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
|
||||
|
@ -54,7 +54,7 @@ var wpAjax = jQuery.extend( {
|
|||
},
|
||||
validateForm: function( selector ) {
|
||||
selector = jQuery( selector );
|
||||
return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() === ''; } ) ).size();
|
||||
return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() === ''; } ) ).length;
|
||||
}
|
||||
}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } );
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
var wpAjax=jQuery.extend({unserialize:function(a){var b,c,d,e,f={};if(!a)return f;b=a.split("?"),b[1]&&(a=b[1]),c=a.split("&");for(d in c)(!jQuery.isFunction(c.hasOwnProperty)||c.hasOwnProperty(d))&&(e=c[d].split("="),f[e[0]]=e[1]);return f},parseAjaxResponse:function(a,b,c){var d={},e=jQuery("#"+b).empty(),f="";return a&&"object"==typeof a&&a.getElementsByTagName("wp_ajax")?(d.responses=[],d.errors=!1,jQuery("response",a).each(function(){var b,e=jQuery(this),g=jQuery(this.firstChild);b={action:e.attr("action"),what:g.get(0).nodeName,id:g.attr("id"),oldId:g.attr("old_id"),position:g.attr("position")},b.data=jQuery("response_data",g).text(),b.supplemental={},jQuery("supplemental",g).children().each(function(){b.supplemental[this.nodeName]=jQuery(this).text()}).size()||(b.supplemental=!1),b.errors=[],jQuery("wp_error",g).each(function(){var e,g,h,i=jQuery(this).attr("code");e={code:i,message:this.firstChild.nodeValue,data:!1},g=jQuery('wp_error_data[code="'+i+'"]',a),g&&(e.data=g.get()),h=jQuery("form-field",g).text(),h&&(i=h),c&&wpAjax.invalidateForm(jQuery("#"+c+' :input[name="'+i+'"]').parents(".form-field:first")),f+="<p>"+e.message+"</p>",b.errors.push(e),d.errors=!0}).size()||(b.errors=!1),d.responses.push(b)}),f.length&&e.html('<div class="error">'+f+"</div>"),d):isNaN(a)?!e.html('<div class="error"><p>'+a+"</p></div>"):(a=parseInt(a,10),-1==a?!e.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>"):0===a?!e.html('<div class="error"><p>'+wpAjax.broken+"</p></div>"):!0)},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").find("input").one("change wp-check-valid-field",function(){jQuery(this).closest(".form-invalid").removeClass("form-invalid")})},validateForm:function(a){return a=jQuery(a),!wpAjax.invalidateForm(a.find(".form-required").filter(function(){return""===jQuery("input:visible",this).val()})).size()}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."});jQuery(document).ready(function(a){a("form.validate").submit(function(){return wpAjax.validateForm(a(this))})});
|
||||
var wpAjax=jQuery.extend({unserialize:function(a){var b,c,d,e,f={};if(!a)return f;b=a.split("?"),b[1]&&(a=b[1]),c=a.split("&");for(d in c)(!jQuery.isFunction(c.hasOwnProperty)||c.hasOwnProperty(d))&&(e=c[d].split("="),f[e[0]]=e[1]);return f},parseAjaxResponse:function(a,b,c){var d={},e=jQuery("#"+b).empty(),f="";return a&&"object"==typeof a&&a.getElementsByTagName("wp_ajax")?(d.responses=[],d.errors=!1,jQuery("response",a).each(function(){var b,e=jQuery(this),g=jQuery(this.firstChild);b={action:e.attr("action"),what:g.get(0).nodeName,id:g.attr("id"),oldId:g.attr("old_id"),position:g.attr("position")},b.data=jQuery("response_data",g).text(),b.supplemental={},jQuery("supplemental",g).children().each(function(){b.supplemental[this.nodeName]=jQuery(this).text()}).length||(b.supplemental=!1),b.errors=[],jQuery("wp_error",g).each(function(){var e,g,h,i=jQuery(this).attr("code");e={code:i,message:this.firstChild.nodeValue,data:!1},g=jQuery('wp_error_data[code="'+i+'"]',a),g&&(e.data=g.get()),h=jQuery("form-field",g).text(),h&&(i=h),c&&wpAjax.invalidateForm(jQuery("#"+c+' :input[name="'+i+'"]').parents(".form-field:first")),f+="<p>"+e.message+"</p>",b.errors.push(e),d.errors=!0}).length||(b.errors=!1),d.responses.push(b)}),f.length&&e.html('<div class="error">'+f+"</div>"),d):isNaN(a)?!e.html('<div class="error"><p>'+a+"</p></div>"):(a=parseInt(a,10),-1==a?!e.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>"):0===a?!e.html('<div class="error"><p>'+wpAjax.broken+"</p></div>"):!0)},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").find("input").one("change wp-check-valid-field",function(){jQuery(this).closest(".form-invalid").removeClass("form-invalid")})},validateForm:function(a){return a=jQuery(a),!wpAjax.invalidateForm(a.find(".form-required").filter(function(){return""===jQuery("input:visible",this).val()})).length}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."});jQuery(document).ready(function(a){a("form.validate").submit(function(){return wpAjax.validateForm(a(this))})});
|
|
@ -336,16 +336,16 @@ wpList = {
|
|||
|
||||
s = $.extend(_s, this.wpList.settings, s);
|
||||
|
||||
if ( !e.size() || !s.what )
|
||||
if ( !e.length || !s.what )
|
||||
return false;
|
||||
|
||||
if ( s.oldId )
|
||||
old = $('#' + s.what + '-' + s.oldId);
|
||||
|
||||
if ( s.id && ( s.id != s.oldId || !old || !old.size() ) )
|
||||
if ( s.id && ( s.id != s.oldId || !old || !old.length ) )
|
||||
$('#' + s.what + '-' + s.id).remove();
|
||||
|
||||
if ( old && old.size() ) {
|
||||
if ( old && old.length ) {
|
||||
old.before(e);
|
||||
old.remove();
|
||||
} else if ( isNaN(s.pos) ) {
|
||||
|
@ -358,7 +358,7 @@ wpList = {
|
|||
|
||||
ref = list.find( '#' + s.pos );
|
||||
|
||||
if ( 1 === ref.size() )
|
||||
if ( 1 === ref.length )
|
||||
ref[ba](e);
|
||||
else
|
||||
list.append(e);
|
||||
|
@ -389,11 +389,11 @@ wpList = {
|
|||
|
||||
e = $(e);
|
||||
|
||||
if ( list.wpList && e.parents( '#' + list.id ).size() )
|
||||
if ( list.wpList && e.parents( '#' + list.id ).length )
|
||||
return;
|
||||
|
||||
e.find(':input').each( function() {
|
||||
if ( $(this).parents('.form-no-clear').size() )
|
||||
if ( $(this).parents('.form-no-clear').length )
|
||||
return;
|
||||
|
||||
t = this.type.toLowerCase();
|
||||
|
@ -437,7 +437,7 @@ wpList = {
|
|||
|
||||
items = $('.list-item:visible', list);
|
||||
|
||||
if ( !items.size() )
|
||||
if ( !items.length )
|
||||
items = $(list).children(':visible');
|
||||
|
||||
eo = [':even',':odd'];
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36285';
|
||||
$wp_version = '4.5-alpha-36286';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue