Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:jquery/jquery

  • Loading branch information...
dmethvin committed Oct 16, 2012
2 parents ef7bce7 + aeb0368 commit 947acfc32e7cc72a3523d177716888b7d6d91c87
@@ -21,14 +21,14 @@ module.exports = function( grunt ) {
return data;
}

var file = grunt.file;
var log = grunt.log;
var verbose = grunt.verbose;
var config = grunt.config;
var distpaths = [
"dist/jquery.js",
"dist/jquery.min.js"
];
var file = grunt.file,
log = grunt.log,
verbose = grunt.verbose,
config = grunt.config,
distpaths = [
"dist/jquery.js",
"dist/jquery.min.js"
];

grunt.initConfig({
pkg: "<json:package.json>",
@@ -247,6 +247,7 @@ jQuery.extend({
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );

return target;
},

@@ -557,8 +558,9 @@ jQuery.extend({

// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );

// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
@@ -1,7 +1,12 @@
// Limit scope pollution from any deprecated API
(function() {

var matched, browser;
var matched, browser, eventAdd, eventRemove,
oldToggle = jQuery.fn.toggle,
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};

// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
@@ -60,10 +65,6 @@ jQuery.sub = function() {
return jQuerySub;
};

// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
jQuery.attrFn = {};

var oldToggle = jQuery.fn.toggle;
jQuery.fn.toggle = function( fn, fn2 ) {

if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
@@ -72,19 +73,19 @@ jQuery.fn.toggle = function( fn, fn2 ) {

// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );

// Make sure that clicks stop
event.preventDefault();
// Make sure that clicks stop
event.preventDefault();

// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};

// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
@@ -95,4 +96,32 @@ jQuery.fn.toggle = function( fn, fn2 ) {
return this.click( toggler );
};


// Support for 'hover' type
eventAdd = jQuery.event.add;

// Duck punch jQuery.event.add, and jquery.event.remove
// Signatures:
// jQuery.event = {
// add: function( elem, types, handler, data, selector ) {
// remove: function( elem, types, handler, selector, mappedTypes ) {
jQuery.event.add = function( elem, types, handler, data, selector ){
if ( types ) {
types = hoverHack( types );
}
eventAdd.call( this, elem, types, handler, data, selector );
};

eventRemove = jQuery.event.remove;

jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
if ( types ) {
types = hoverHack( types );
}
eventRemove.call( this, elem, types, handler, selector, mappedTypes );
};

// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
jQuery.attrFn = {};

})();
@@ -1,12 +1,8 @@
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;

/*
* Helper functions for managing events -- not part of the public interface.
@@ -56,7 +52,7 @@ jQuery.event = {

// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
types = jQuery.trim( types ).split( " " );
for ( t = 0; t < types.length; t++ ) {

tns = rtypenamespace.exec( types[t] ) || [];
@@ -139,7 +135,7 @@ jQuery.event = {
}

// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
types = jQuery.trim( types ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
@@ -281,9 +281,12 @@ jQuery.fn.extend({
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
return this.each(function( index ) {
// HTML argument replaced by "this" element
// 1. There were no supporting tests
// 2. There was no internal code relying on this
// 3. There was no documentation of an html argument
jQuery( this ).replaceWith( value.call( this, index, this ) );
});
}

Submodule sizzle updated 3 files
+99 −77 sizzle.js
+43 −8 test/unit/selector.js
+53 −1 test/unit/utilities.js
@@ -172,7 +172,7 @@ jQuery.support = (function() {
// Run tests that need a body at doc ready
jQuery(function() {
var container, div, tds, marginDiv,
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];

if ( !body ) {
@@ -132,9 +132,7 @@ jQuery.fn.extend({
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );

return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
return this.pushStack( jQuery.unique(all) );
},

addBack: function( selector ) {
@@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
</style>
</head>
<body>
<div>
<script src="../../../dist/jquery.js"></script>
</div>
<script>
jQuery(function() {
window.parent.iframeCallback( jQuery.support.shrinkWrapBlocks );
});
</script>
</body>
</html>
@@ -1451,7 +1451,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {


jQuery.each( [ "Same Domain", "Cross Domain" ], function( crossDomain, label ) {

asyncTest( "jQuery.ajax() - JSONP, Query String (?n)" + label, function() {
expect( 4 );

@@ -1543,7 +1543,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
plus();
}
});

window["jsonpResults"] = function( data ) {
ok( data["data"], "JSON results returned (GET, custom callback function)" );
window["jsonpResults"] = undefined;
@@ -2725,4 +2725,38 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
expect( 1 );
ok( jQuery.active === 0, "ajax active counter should be zero: " + jQuery.active );
});

test("jQuery.ajax - falsy url as argument (#10093)", function() {
expect( 4 );

jQuery.ajaxSetup({ timeout: 0 });

stop();

jQuery.when(
jQuery.ajax("").success(function(){ ok( true, "settings object - empty string" ); }),
jQuery.ajax( false ).success(function(){ ok( true, "false" ); }),
jQuery.ajax( null ).success(function(){ ok( true, "null" ); }),
jQuery.ajax( undefined ).success(function(){ ok( true, "undefined" ); })
).always(function () {
start();
});
});

test("jQuery.ajax - falsy url in settings object (#10093)", function() {
expect( 4 );

jQuery.ajaxSetup({ timeout: 0 });

stop();

jQuery.when(
jQuery.ajax({ url: "" }).success(function(){ ok( true, "settings object - empty string" ); }),
jQuery.ajax({ url: false }).success(function(){ ok( true, "false" ); }),
jQuery.ajax({ url: null }).success(function(){ ok( true, "null" ); }),
jQuery.ajax({ url: undefined }).success(function(){ ok( true, "undefined" ); })
).always(function () {
start();
});
});
}

0 comments on commit 947acfc

Please sign in to comment.
You can’t perform that action at this time.