Use event delegation in wp-lists.js. Fixes #15488

git-svn-id: http://svn.automattic.com/wordpress/trunk@16486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-19 16:11:56 +00:00
parent e074436af0
commit 8ab7aafec4
3 changed files with 20 additions and 8 deletions

View File

@ -321,12 +321,24 @@ wpList = {
},
process: function(el) {
var list = this;
$("[class^=add:" + list.id + ":]", el || null)
.filter('form').submit( function() { return list.wpList.add(this); } ).end()
.not('form').click( function() { return list.wpList.add(this); } );
$("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } );
$("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } );
var list = this,
$el = $(el || document);
$el.delegate( "form[class^=add:" + list.id + ":]", 'submit', function(){
return list.wpList.add(this);
});
$el.delegate( "[class^=add:" + list.id + ":]:not(form)", 'click', function(){
return list.wpList.add(this);
});
$el.delegate( "[class^=delete:" + list.id + ":]", 'click', function(){
return list.wpList.del(this);
});
$el.delegate( "[class^=dim:" + list.id + ":]", 'click', function(){
return list.wpList.dim(this);
});
},
recolor: function() {

File diff suppressed because one or more lines are too long

View File

@ -106,7 +106,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20101004' );
$scripts->add_data( 'autosave', 'group', 1 );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091128' );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20101119' );
$scripts->add_data( 'wp-lists', 'group', 1 );
$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.3');