Compare commits

...

13 Commits

Author SHA1 Message Date
Denis Knauf bb7d98f018 input type=datetime-local support for ajax. 2011-07-07 12:13:10 +02:00
jaubourg e6f8951983 Fixes #9632. Adds res:// protocol to the list of local protocols. 2011-07-01 02:18:05 +02:00
jaubourg e83fcdcb02 Fixes #9682. Removes data from the options for request with no content so that it is not used again in case of a retry. Unit test added. 2011-07-01 02:11:26 +02:00
jaubourg 139135a98a Fixes #9446. Context is properly propagated using pipe. If context was the original deferred, then context is updated to next deferred in the chain. Unit tests added. 2011-07-01 01:51:50 +02:00
jaubourg 5b92a5f5ec Replaces typo (status instead of state) as observed in #9585. 2011-07-01 00:16:34 +02:00
John Resig e2ab2ba1d5 Updating the source version to 1.6.3pre 2011-06-30 14:17:44 -04:00
John Resig aa6f8c8cd3 Tagging the 1.6.2 release. 2011-06-30 14:16:56 -04:00
timmywil ab1504f14f Set timerId to true instead of a number so that intervals set to 1 are not accidentally cleared when stopped. Fixes #9678.
- Adding a working test case would not be possible in this case, but all tests pass.
2011-06-28 11:46:03 -04:00
timmywil 96501d38a9 Allow similarly named classes (regression from 9499) and switch class retrieval to property when passing class to value functions. Fixes #9617. 2011-06-19 18:58:47 -04:00
Mike Sherov 124817e668 Landing pull request 413. Move border/padding checks to after width validation to avoid unnecessary fallbacks. Fixes #9598.
More Details:
 - https://github.com/jquery/jquery/pull/413
 - http://bugs.jquery.com/ticket/9300
 - http://bugs.jquery.com/ticket/9441
 - http://bugs.jquery.com/ticket/9598
2011-06-17 17:33:29 -04:00
John Resig d59b0f3e27 Re-updating QUnit, oops. 2011-06-14 15:06:28 -07:00
John Resig d269e426e0 Updating version in release notes script. 2011-06-14 15:05:27 -07:00
John Resig 138d5b7b81 Updating the source version to 1.6.2pre 2011-06-14 14:55:14 -07:00
11 changed files with 89 additions and 41 deletions

View File

@ -9,9 +9,9 @@ var fs = require("fs"),
extract = /<a href="\/ticket\/(\d+)" title="View ticket">(.*?)<[^"]+"component">\s*(\S+)/g;
var opts = {
version: "1.6.1",
short_version: "1.6.1",
final_version: "1.6.1",
version: "1.6.2 RC 1",
short_version: "1.6.2rc1",
final_version: "1.6.2",
categories: []
};

View File

@ -5,9 +5,9 @@ var r20 = /%20/g,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
@ -644,6 +644,8 @@ jQuery.extend({
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
@ -727,7 +729,7 @@ jQuery.extend({
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( status < 2 ) {
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {

View File

@ -37,12 +37,12 @@ jQuery.fn.extend({
},
addClass: function( value ) {
var classNames, i, l, elem, setClass, c, cl;
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
var self = jQuery( this );
self.addClass( value.call(this, j, self.attr("class") || "") );
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
@ -57,11 +57,11 @@ jQuery.fn.extend({
elem.className = value;
} else {
setClass = elem.className;
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf(classNames[ c ]) ) {
setClass += " " + classNames[ c ];
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
@ -78,8 +78,7 @@ jQuery.fn.extend({
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
var self = jQuery( this );
self.removeClass( value.call(this, j, self.attr("class")) );
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
@ -112,9 +111,8 @@ jQuery.fn.extend({
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this);
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}

View File

@ -315,21 +315,20 @@ function getWH( elem, name, extra ) {
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( extra !== "margin" && extra !== "border" ) {
jQuery.each( which, function() {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
});
}
if ( val > 0 ) {
if ( extra === "margin" ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}

View File

@ -122,7 +122,7 @@ jQuery.extend({
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject );
} else {
newDefer[ action ]( returned );
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {

2
src/effects.js vendored
View File

@ -411,7 +411,7 @@ jQuery.fx.prototype = {
if ( t() && jQuery.timers.push(t) && !timerId ) {
// Use requestAnimationFrame instead of setInterval if available
if ( requestAnimationFrame ) {
timerId = 1;
timerId = true;
raf = function() {
// When timerId gets set to null at any point, this stops
if ( timerId ) {

@ -1 +1 @@
Subproject commit d97b37ec322136406790e75d03333559f38bbecb
Subproject commit d4f23f8a882d13b71768503e2db9fa33ef169ba0

View File

@ -321,25 +321,40 @@ test("jQuery.ajax() - responseText on error", function() {
test(".ajax() - retry with jQuery.ajax( this )", function() {
expect( 1 );
expect( 2 );
stop();
var firstTime = 1;
var firstTime = true,
previousUrl;
jQuery.ajax({
url: url("data/errorWithText.php"),
error: function() {
if ( firstTime ) {
firstTime = 0;
firstTime = false;
jQuery.ajax( this );
} else {
ok( true , "Test retrying with jQuery.ajax(this) works" );
start();
jQuery.ajax({
url: url("data/errorWithText.php"),
data: { x: 1 },
beforeSend: function() {
if ( !previousUrl ) {
previousUrl = this.url;
} else {
strictEqual( this.url , previousUrl, "url parameters are not re-appended" );
start();
return false;
}
},
error: function() {
jQuery.ajax( this );
}
});
}
}
});
});
test(".ajax() - headers" , function() {

View File

@ -762,7 +762,8 @@ test("val(select) after form.reset() (Bug #2551)", function() {
});
var testAddClass = function(valueObj) {
expect(7);
expect(9);
var div = jQuery("div");
div.addClass( valueObj("test") );
var pass = true;
@ -791,10 +792,16 @@ var testAddClass = function(valueObj) {
div.addClass( valueObj("bar baz") );
equals( div.attr("class"), "foo bar baz", "Make sure there isn't too much trimming." );
div.removeAttr("class");
div.removeClass();
div.addClass( valueObj("foo") ).addClass( valueObj("foo") )
equal( div.attr("class"), "foo", "Do not add the same class twice in separate calls." );
div.removeAttr("class");
div.addClass( valueObj("fo") );
equal( div.attr("class"), "foo fo", "Adding a similar class does not get interrupted." );
div.removeClass().addClass("wrap2");
ok( div.addClass("wrap").hasClass("wrap"), "Can add similarly named classes");
div.removeClass();
div.addClass( valueObj("bar bar") );
equal( div.attr("class"), "bar", "Do not add the same class twice in the same call." );
};
@ -959,7 +966,7 @@ test("toggleClass(Function[, boolean])", function() {
test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
expect(14);
var e = jQuery("#firstp"), old = e.attr("class");
var e = jQuery("#firstp"), old = e.attr("class") || "";
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass(function(i, val) {

View File

@ -275,6 +275,33 @@ test( "jQuery.Deferred.pipe - deferred (fail)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
test( "jQuery.Deferred.pipe - context", function() {
expect(4);
var context = {};
jQuery.Deferred().resolveWith( context, [ 2 ] ).pipe(function( value ) {
return value * 3;
}).done(function( value ) {
strictEqual( this, context, "custom context correctly propagated" );
strictEqual( value, 6, "proper value received" );
});
var defer = jQuery.Deferred(),
piped = defer.pipe(function( value ) {
return value * 3;
});
defer.resolve( 2 );
piped.done(function( value ) {
strictEqual( this.promise(), piped, "default context gets updated to latest defer in the chain" );
strictEqual( value, 6, "proper value received" );
});
});
test( "jQuery.when" , function() {
expect( 23 );

View File

@ -1 +1 @@
1.6.2rc1
1.6.3pre