jquery core: closes #3248, #3079, #3026, #3176, #3202, #3129. jQuery.makeArray doesn't support functions anymore. Voiding the conflict with Scriptaculous 1.7.x.
This commit is contained in:
parent
c9c024280a
commit
1023cf1d72
2 changed files with 10 additions and 5 deletions
|
@ -1125,13 +1125,15 @@ jQuery.extend({
|
||||||
return (text || "").replace( /^\s+|\s+$/g, "" );
|
return (text || "").replace( /^\s+|\s+$/g, "" );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// NOTE: Due to the conflict with Scriptaculous (http://dev.jquery.com/ticket/3248)
|
||||||
|
// We remove support for functions since jQuery 1.3
|
||||||
makeArray: function( array ) {
|
makeArray: function( array ) {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
|
|
||||||
if( array != null ){
|
if( array != null ){
|
||||||
var i = array.length;
|
var i = array.length;
|
||||||
//the window, strings and functions also have 'length'
|
// The window, strings (and functions) also have 'length'
|
||||||
if( i == null || array.split || array.setInterval || array.call )
|
if( i == null || array.split || array.setInterval )
|
||||||
ret[0] = array;
|
ret[0] = array;
|
||||||
else
|
else
|
||||||
while( i )
|
while( i )
|
||||||
|
|
|
@ -1684,7 +1684,7 @@ test("contents()", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("jQuery.makeArray", function(){
|
test("jQuery.makeArray", function(){
|
||||||
expect(15);
|
expect(14);
|
||||||
|
|
||||||
equals( jQuery.makeArray(jQuery('html>*'))[0].nodeName, "HEAD", "Pass makeArray a jQuery object" );
|
equals( jQuery.makeArray(jQuery('html>*'))[0].nodeName, "HEAD", "Pass makeArray a jQuery object" );
|
||||||
|
|
||||||
|
@ -1708,8 +1708,11 @@ test("jQuery.makeArray", function(){
|
||||||
|
|
||||||
ok( !!jQuery.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "Pass makeArray a childNodes array" );
|
ok( !!jQuery.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "Pass makeArray a childNodes array" );
|
||||||
|
|
||||||
//function, is tricky as it has length
|
// function, is tricky as it has length
|
||||||
equals( jQuery.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" );
|
// NOTE: Due to the conflict with Scriptaculous (http://dev.jquery.com/ticket/3248)
|
||||||
|
// We remove support for functions since jQuery 1.3
|
||||||
|
//equals( jQuery.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" );
|
||||||
|
|
||||||
//window, also has length
|
//window, also has length
|
||||||
equals( jQuery.makeArray(window)[0], window, "Pass makeArray the window" );
|
equals( jQuery.makeArray(window)[0], window, "Pass makeArray the window" );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue