From 138d5b7b811845950279f5ee5391339d7d31e360 Mon Sep 17 00:00:00 2001 From: John Resig Date: Tue, 14 Jun 2011 14:55:14 -0700 Subject: [PATCH 01/13] Updating the source version to 1.6.2pre --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index a0de7ec1..22e67ce2 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.2rc1 \ No newline at end of file +1.6.2pre \ No newline at end of file From d269e426e0844fa025e8ca5510c56860a9cde784 Mon Sep 17 00:00:00 2001 From: John Resig Date: Tue, 14 Jun 2011 15:05:27 -0700 Subject: [PATCH 02/13] Updating version in release notes script. --- build/release-notes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/release-notes.js b/build/release-notes.js index 57d03789..b112d998 100644 --- a/build/release-notes.js +++ b/build/release-notes.js @@ -9,9 +9,9 @@ var fs = require("fs"), extract = /(.*?)<[^"]+"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: [] }; From d59b0f3e27827d189b8b2595142ec6bbc3941dd9 Mon Sep 17 00:00:00 2001 From: John Resig Date: Tue, 14 Jun 2011 15:06:28 -0700 Subject: [PATCH 03/13] Re-updating QUnit, oops. --- test/qunit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/qunit b/test/qunit index d97b37ec..d4f23f8a 160000 --- a/test/qunit +++ b/test/qunit @@ -1 +1 @@ -Subproject commit d97b37ec322136406790e75d03333559f38bbecb +Subproject commit d4f23f8a882d13b71768503e2db9fa33ef169ba0 From 124817e6684086ccf74e509309b73d4b4dd89932 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Fri, 17 Jun 2011 17:33:29 -0400 Subject: [PATCH 04/13] 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 --- src/css.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/css.js b/src/css.js index c60bcdde..cb7df9f8 100644 --- a/src/css.js +++ b/src/css.js @@ -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"; } From 96501d38a935187461d45c40f17f8327b2e7cd91 Mon Sep 17 00:00:00 2001 From: timmywil Date: Sun, 19 Jun 2011 18:58:47 -0400 Subject: [PATCH 05/13] Allow similarly named classes (regression from 9499) and switch class retrieval to property when passing class to value functions. Fixes #9617. --- src/attributes.js | 20 +++++++++----------- test/unit/attributes.js | 15 +++++++++++---- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/attributes.js b/src/attributes.js index ce7b3502..1e0e79f4 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -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 ); }); } diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 831f729c..4716e5b5 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -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) { From ab1504f14f56944a5a6297c68b323f0af01d5be8 Mon Sep 17 00:00:00 2001 From: timmywil Date: Tue, 28 Jun 2011 11:46:03 -0400 Subject: [PATCH 06/13] 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. --- src/effects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/effects.js b/src/effects.js index 3a4e2663..a7529a0f 100644 --- a/src/effects.js +++ b/src/effects.js @@ -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 ) { From aa6f8c8cd399d50e91dc0a3634395b6ebf54b209 Mon Sep 17 00:00:00 2001 From: John Resig Date: Thu, 30 Jun 2011 14:16:56 -0400 Subject: [PATCH 07/13] Tagging the 1.6.2 release. --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 22e67ce2..308b6faa 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.2pre \ No newline at end of file +1.6.2 \ No newline at end of file From e2ab2ba1d51b47f90fd8022e500ea3df563e7d74 Mon Sep 17 00:00:00 2001 From: John Resig Date: Thu, 30 Jun 2011 14:17:44 -0400 Subject: [PATCH 08/13] Updating the source version to 1.6.3pre --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 308b6faa..e37c079f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.2 \ No newline at end of file +1.6.3pre \ No newline at end of file From 5b92a5f5eccf69d480c11dbd2870f8161ae0441b Mon Sep 17 00:00:00 2001 From: jaubourg Date: Thu, 30 Jun 2011 18:18:44 +0200 Subject: [PATCH 09/13] Replaces typo (status instead of state) as observed in #9585. --- src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index a16717b0..e4e48dc7 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -727,7 +727,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 { From 139135a98aab1c422e5ae05b026535a40d58328f Mon Sep 17 00:00:00 2001 From: jaubourg Date: Fri, 1 Jul 2011 01:51:50 +0200 Subject: [PATCH 10/13] 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. --- src/deferred.js | 2 +- test/unit/deferred.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/deferred.js b/src/deferred.js index 5cc5fb5b..e543f151 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -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 { diff --git a/test/unit/deferred.js b/test/unit/deferred.js index 89c9c612..fbe29070 100644 --- a/test/unit/deferred.js +++ b/test/unit/deferred.js @@ -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 ); From e83fcdcb02d676d91d764a58f7e8d2eb1c95de69 Mon Sep 17 00:00:00 2001 From: jaubourg Date: Fri, 1 Jul 2011 02:11:26 +0200 Subject: [PATCH 11/13] 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. --- src/ajax.js | 2 ++ test/unit/ajax.js | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index e4e48dc7..650f3318 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -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 diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 9f084136..33433922 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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() { From e6f8951983b8ce1af8986651fd412f9e569504c6 Mon Sep 17 00:00:00 2001 From: jaubourg Date: Fri, 1 Jul 2011 02:18:05 +0200 Subject: [PATCH 12/13] Fixes #9632. Adds res:// protocol to the list of local protocols. --- src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 650f3318..087f2feb 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -7,7 +7,7 @@ var r20 = /%20/g, 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, // #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 = /\?/, From bb7d98f018c284a27b286a819238bac5541aad5e Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Thu, 7 Jul 2011 12:13:10 +0200 Subject: [PATCH 13/13] input type=datetime-local support for ajax. --- src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 087f2feb..355fd7e4 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -5,7 +5,7 @@ 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|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/,