Removes definition of createList and use jQuery.Callbacks directly to make things a bit less obfuscated.

This commit is contained in:
jaubourg 2011-05-08 16:12:43 +02:00
parent 198290a9a7
commit 3a6b759d3c

View file

@ -40,10 +40,6 @@ var output,
jQuery.each( tests, function( flags, resultString ) { jQuery.each( tests, function( flags, resultString ) {
function createList() {
return jQuery.Callbacks( flags );
}
jQuery.each( filters, function( filterLabel, filter ) { jQuery.each( filters, function( filterLabel, filter ) {
test( "jQuery.Callbacks( \"" + flags + "\" ) - " + filterLabel, function() { test( "jQuery.Callbacks( \"" + flags + "\" ) - " + filterLabel, function() {
@ -59,7 +55,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Basic binding and firing // Basic binding and firing
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add(function( str ) { cblist.add(function( str ) {
output += str; output += str;
}); });
@ -76,7 +72,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Basic binding and firing (context, arguments) // Basic binding and firing (context, arguments)
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add(function() { cblist.add(function() {
equals( this, window, "Basic binding and firing (context)" ); equals( this, window, "Basic binding and firing (context)" );
output += Array.prototype.join.call( arguments, "" ); output += Array.prototype.join.call( arguments, "" );
@ -86,7 +82,7 @@ jQuery.each( tests, function( flags, resultString ) {
// fireWith with no arguments // fireWith with no arguments
output = ""; output = "";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add(function() { cblist.add(function() {
equals( this, window, "fireWith with no arguments (context is window)" ); equals( this, window, "fireWith with no arguments (context is window)" );
strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" ); strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" );
@ -95,7 +91,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Basic binding, removing and firing // Basic binding, removing and firing
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add( outputA ); cblist.add( outputA );
cblist.add( outputB ); cblist.add( outputB );
cblist.add( outputC ); cblist.add( outputC );
@ -105,7 +101,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Empty // Empty
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add( outputA ); cblist.add( outputA );
cblist.add( outputB ); cblist.add( outputB );
cblist.add( outputC ); cblist.add( outputC );
@ -115,7 +111,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Locking // Locking
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add( function( str ) { cblist.add( function( str ) {
output += str; output += str;
}); });
@ -131,7 +127,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Ordering // Ordering
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add( function() { cblist.add( function() {
cblist.add( outputC ); cblist.add( outputC );
outputA(); outputA();
@ -153,7 +149,7 @@ jQuery.each( tests, function( flags, resultString ) {
// Multiple fire // Multiple fire
output = "X"; output = "X";
cblist = createList(); cblist = jQuery.Callbacks( flags );
cblist.add( function( str ) { cblist.add( function( str ) {
output += str; output += str;
} ); } );