From d8aa8e71b0e015a2bcdd33a66f18892e0129b704 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 23 Jul 2012 14:51:55 -0400 Subject: [PATCH 01/34] Sizzle: fix issue with adjusting the context on relative combinators in element-rooted qSA --- src/sizzle | 2 +- test/unit/event.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sizzle b/src/sizzle index 6e524a591..deb73a18e 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 6e524a5915a8a5dda1969898749c81d0fae64e6e +Subproject commit deb73a18e2e80d8e1a482f1d557b5e8eab545213 diff --git a/test/unit/event.js b/test/unit/event.js index dacb03355..ecaddf3a4 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2344,7 +2344,7 @@ test("jQuery.off using dispatched jQuery.Event", function() { test( "delegated event with delegateTarget-relative selector", function() { expect(2); - var markup = jQuery( '' ).appendTo("body"); + var markup = jQuery("").appendTo("#qunit-fixture"); markup .on( "click", ">li>a", function() { From 3adc59efa6b16da98a37ef0641998cda0aee1a74 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 23 Jul 2012 15:37:41 -0400 Subject: [PATCH 02/34] Sizzle: fixes test fails in IE6/7 --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index deb73a18e..3c6916332 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit deb73a18e2e80d8e1a482f1d557b5e8eab545213 +Subproject commit 3c6916332ea21ffed7ef81921e9eaa57fa2d98a6 From 91dfb28dd8ed9e29cf383e8b94f1b4fd06eee65a Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 23 Jul 2012 19:39:58 -0400 Subject: [PATCH 03/34] Update Sizzle --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index 3c6916332..683924fb7 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 3c6916332ea21ffed7ef81921e9eaa57fa2d98a6 +Subproject commit 683924fb73bafc5447b86cc5a38a4d99108e1196 From 077987876bbd01b8b48a72b3573694fafaa44d39 Mon Sep 17 00:00:00 2001 From: Elijah Manor Date: Tue, 24 Jul 2012 14:34:14 -0400 Subject: [PATCH 04/34] Fix #12132. IE10 dislikes detached object elements. Close gh-870. --- src/manipulation.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/manipulation.js b/src/manipulation.js index d118529d4..212eaf6bb 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -436,11 +436,12 @@ function cloneFixAttributes( src, dest ) { nodeName = dest.nodeName.toLowerCase(); - // IE6-8 fail to clone children inside object elements that use - // the proprietary classid attribute value (rather than the type - // attribute) to identify the type of content to display if ( nodeName === "object" ) { - dest.outerHTML = src.outerHTML; + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. From 717cb2a5c7909ed16f7c599b02759b27fd2e4258 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Tue, 24 Jul 2012 22:55:06 -0400 Subject: [PATCH 05/34] Add grunt-git-authors task. --- grunt.js | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 02a688162..61b7b4e4b 100644 --- a/grunt.js +++ b/grunt.js @@ -121,8 +121,9 @@ module.exports = function( grunt ) { // Short list as a high frequency watch task grunt.registerTask( "dev", "selector build:*:* lint" ); - // Load the "compare_size" task from NPM packages + // Load grunt tasks from NPM packages grunt.loadNpmTasks( "grunt-compare-size" ); + grunt.loadNpmTasks( "grunt-git-authors" ); grunt.registerTask( "testswarm", function( commit, configFile ) { var testswarm = require( "testswarm" ), diff --git a/package.json b/package.json index ecebd2cc2..3ac92df77 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "dependencies": {}, "devDependencies": { "grunt-compare-size": ">=0.1.0", + "grunt-git-authors": ">=1.0.0", "grunt": "~0.3.9", "testswarm": "0.2.2" }, From fffd23285adfc31e994c0c83503eb283eab75bbd Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Tue, 24 Jul 2012 23:45:12 -0400 Subject: [PATCH 06/34] Initial commit of AUTHORS.txt file. --- AUTHORS.txt | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 AUTHORS.txt diff --git a/AUTHORS.txt b/AUTHORS.txt new file mode 100644 index 000000000..774d11b32 --- /dev/null +++ b/AUTHORS.txt @@ -0,0 +1,131 @@ +Authors ordered by first contribution. + +John Resig +Gilles van den Hoven +Michael Geary +Stefan Petre +Yehuda Katz +Corey Jewett +Klaus Hartl +Franck Marcia +Jörn Zaefferer +Paul Bakaus +Brandon Aaron +Mike Alsup +Dave Methvin +Ed Engelhardt +Sean Catchpole +Paul Mclanahan +David Serduke +Richard D. Worth +Scott González +Ariel Flesler +Jon Evans +T.J. Holowaychuk +Michael Bensoussan +Robert Katić +Louis-Rémi Babé +Earle Castledine +Damian Janowski +Rich Dougherty +Kim Dalsgaard +Andrea Giammarchi +Mark Gibson +Karl Swedberg +Justin Meyer +Ben Alman +James Padolsey +David Petersen +Batiste Bieler +Alexander Farkas +Rick Waldron +Filipe Fortes +Neeraj Singh +Paul Irish +Iraê Carvalho +Matt Curry +Michael Monteleone +Noah Sloan +Tom Viner +Douglas Neiner +Adam J. Sontag +Dave Reed +Ralph Whitbeck +Carl Fürstenberg +Jacob Wright +J. Ryan Stinnett +Heungsub Lee +Colin Snover +Ryan W Tenney +R.J.G. Otten +Jephte Clain +Anton Matzneller +Alex Sexton +Dan Heberden +Henri Wiechers +Russell Holbrook +Julian Aubourg +Gianni Chiappetta +Scott Jehl +J.R. Burke +Jonas Pfenniger +Xavi Ramirez +Jared Grippe +Sylvester Keil +Brandon Sterne +Mathias Bynens +Timmy Willison +Corey Frang +Anton Kovalyov +David Murdoch +Josh Varner +Charles McNulty +Jordan Boesch +Jess Thrysoee +Michael Murray +Lee Carpenter +Alexis Abril +Rob Morgan +John Firebaugh +Sam Bisbee +Gilmore Davidson +Brian Brennan +Xavier Montillet +Daniel Pihlstrom +Sahab Yazdani +Scott Hughes +Mike Sherov +Greg Hazel +Schalk Neethling +Denis Knauf +Timo Tijhof +Steen Nielsen +Anton Ryzhov +Shi Chuan +Berker Peksag +Toby Brain +Matt Mueller +Daniel Herman +Oleg Gaidarenko +Richard Gibson +Rafaël Blais Masson +Joe Presbrey +Sindre Sorhus +Arne de Bree +Vladislav Zarakovsky +Andy Monat +Joaoh Bruni +Dominik D. Geyer +Matt Farmer +Trey Hunner +Jason Moon +Jeffery To +Kris Borchers +Vladimir Zhuravlev +Jacob Thornton +Chad Killingsworth +Nowres Rafid +David Benjamin +Uri Gilad +Chris Faulkner +Elijah Manor From 569d064fc93459695cb6eb6fd09e5ba3fda62f03 Mon Sep 17 00:00:00 2001 From: Daniel Chatfield Date: Wed, 25 Jul 2012 09:32:33 -0400 Subject: [PATCH 07/34] Fix #12127. IE9/10 checks fall off the box on clone. Close gh-873. --- AUTHORS.txt | 1 + src/manipulation.js | 4 +--- src/support.js | 6 +++--- test/unit/manipulation.js | 11 +++++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 774d11b32..51200abaf 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -129,3 +129,4 @@ David Benjamin Uri Gilad Chris Faulkner Elijah Manor +Daniel Chatfield diff --git a/src/manipulation.js b/src/manipulation.js index 212eaf6bb..fa6083c09 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -455,9 +455,7 @@ function cloneFixAttributes( src, dest ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set - if ( src.checked ) { - dest.defaultChecked = dest.checked = src.checked; - } + dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" diff --git a/src/support.js b/src/support.js index e4a8b7c83..5bedb4dcb 100644 --- a/src/support.js +++ b/src/support.js @@ -15,7 +15,7 @@ jQuery.support = (function() { // Preliminary tests div.setAttribute( "className", "t" ); - div.innerHTML = "
a"; + div.innerHTML = "
a"; all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; @@ -96,8 +96,8 @@ jQuery.support = (function() { }; // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; + input.checked = false; + support.noCloneChecked = !input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 31426e739..e2b00a662 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1895,3 +1895,14 @@ test("html() - script exceptions bubble (#11743)", function() { ok( false, "error ignored" ); }, "exception bubbled from remote script" ); }); + +test("checked state is cloned with clone()", function(){ + expect(2); + + var elem = jQuery.parseHTML('')[0]; + elem.checked = false; + equal( jQuery(elem).clone().attr('id','clone')[0].checked, false, 'Checked false state correctly cloned' ); + elem = jQuery.parseHTML('')[0]; + elem.checked = true; + equal( jQuery(elem).clone().attr('id','clone')[0].checked, true, 'Checked true state correctly cloned' ); +}); From da4d60929778490094fbf1f9c6abd9ea7d0e0c99 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Wed, 25 Jul 2012 08:49:51 -0400 Subject: [PATCH 08/34] Followup #12018, fix a test fail converting to pixels. Close gh-874. --- src/css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 0b20b7c4c..d8d5239dd 100644 --- a/src/css.js +++ b/src/css.js @@ -290,7 +290,7 @@ if ( window.getComputedStyle ) { // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; From ce15bd7d0c14106521bd21179b1507f2863d1960 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 10:19:09 -0400 Subject: [PATCH 09/34] Fix #7579. Don't convert to number if it changes the string. Close gh-852. Net effect here is that hex numbers and most exponential-format numbers or long sequences of digits will remain strings rather than being coerced to numbers. `The people have spoken. --- src/data.js | 5 +++-- test/unit/data.js | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/data.js b/src/data.js index c7de049a2..f51a3e520 100644 --- a/src/data.js +++ b/src/data.js @@ -304,8 +304,9 @@ function dataAttr( elem, key, data ) { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} diff --git a/test/unit/data.js b/test/unit/data.js index 3083a947d..7f4ad6c36 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -294,7 +294,7 @@ test(".data(String) and .data(String, Object)", function() { }); test("data-* attributes", function() { - expect(38); + expect(40); var div = jQuery("
"), child = jQuery("
"), dummy = jQuery("
"); @@ -357,9 +357,11 @@ test("data-* attributes", function() { .attr("data-five", "5") .attr("data-point", "5.5") .attr("data-pointe", "5.5E3") + .attr("data-grande", "5.574E9") .attr("data-hexadecimal", "0x42") .attr("data-pointbad", "5..5") .attr("data-pointbad2", "-.") + .attr("data-bigassnum", "123456789123456789123456789") .attr("data-badjson", "{123}") .attr("data-badjson2", "[abc]") .attr("data-empty", "") @@ -371,10 +373,12 @@ test("data-* attributes", function() { strictEqual( child.data("false"), false, "Primitive false read from attribute"); strictEqual( child.data("five"), 5, "Primitive number read from attribute"); strictEqual( child.data("point"), 5.5, "Primitive number read from attribute"); - strictEqual( child.data("pointe"), 5500, "Primitive number read from attribute"); - strictEqual( child.data("hexadecimal"), 66, "Hexadecimal number read from attribute"); + strictEqual( child.data("pointe"), "5.5E3", "Floating point exponential number read from attribute"); + strictEqual( child.data("grande"), "5.574E9", "Big exponential number read from attribute"); + strictEqual( child.data("hexadecimal"), "0x42", "Hexadecimal number read from attribute"); strictEqual( child.data("pointbad"), "5..5", "Bad number read from attribute"); strictEqual( child.data("pointbad2"), "-.", "Bad number read from attribute"); + strictEqual( child.data("bigassnum"), "123456789123456789123456789", "Bad bigass number read from attribute"); strictEqual( child.data("badjson"), "{123}", "Bad number read from attribute"); strictEqual( child.data("badjson2"), "[abc]", "Bad number read from attribute"); strictEqual( child.data("empty"), "", "Empty string read from attribute"); From ad5fba759bd36024caa282189f570195aa4d3b5d Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 25 Jul 2012 10:51:48 -0400 Subject: [PATCH 10/34] Update Sizzle: attribute values regex tweak --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index 683924fb7..441c8d433 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 683924fb73bafc5447b86cc5a38a4d99108e1196 +Subproject commit 441c8d4332f690f5ec1941ede65e22861013cfe9 From 647b772ab9ccbc3cd6e1dbd75f8a46a3e56eacec Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 25 Jul 2012 11:01:08 -0400 Subject: [PATCH 11/34] Update Sizzle: minor consolidation --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index 441c8d433..14574d0f5 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 441c8d4332f690f5ec1941ede65e22861013cfe9 +Subproject commit 14574d0f516f0cc3d2c4c22f9d39d9ea8bf1366e From bc07ae8c1dbe9af4cceee3f118ae8071a3a8afb2 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 14:25:39 -0400 Subject: [PATCH 12/34] Loosen the ajax statusText check so Safari AND Chrome pass. --- test/unit/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 85069b482..2371f8982 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -2153,7 +2153,7 @@ test( "jQuery.ajax - statusText" , 3, function() { stop(); jQuery.ajax( url( "data/statusText.php?status=200&text=Hello" ) ).done(function( _, statusText, jqXHR ) { strictEqual( statusText, "success", "callback status text ok for success" ); - ok( jqXHR.statusText === "Hello" || jQuery.browser.safari && jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" ); + ok( jqXHR.statusText === "Hello" || jqXHR.statusText === "OK", "jqXHR status text ok for success (" + jqXHR.statusText + ")" ); jQuery.ajax( url( "data/statusText.php?status=404&text=World" ) ).fail(function( jqXHR, statusText ) { strictEqual( statusText, "error", "callback status text ok for error" ); // ok( jqXHR.statusText === "World" || jQuery.browser.safari && jqXHR.statusText === "Not Found", "jqXHR status text ok for error (" + jqXHR.statusText + ")" ); From de213be3728a339e1f2b98712a0869f8afb9da67 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 14:38:55 -0400 Subject: [PATCH 13/34] Revert "Fix #12127. IE9/10 checks fall off the box on clone. Close gh-873." This reverts commit 569d064fc93459695cb6eb6fd09e5ba3fda62f03. Causing test fails in Safari, IE6, and IE7. --- AUTHORS.txt | 1 - src/manipulation.js | 4 +++- src/support.js | 6 +++--- test/unit/manipulation.js | 11 ----------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 51200abaf..774d11b32 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -129,4 +129,3 @@ David Benjamin Uri Gilad Chris Faulkner Elijah Manor -Daniel Chatfield diff --git a/src/manipulation.js b/src/manipulation.js index fa6083c09..212eaf6bb 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -455,7 +455,9 @@ function cloneFixAttributes( src, dest ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set - dest.defaultChecked = dest.checked = src.checked; + if ( src.checked ) { + dest.defaultChecked = dest.checked = src.checked; + } // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" diff --git a/src/support.js b/src/support.js index 5bedb4dcb..e4a8b7c83 100644 --- a/src/support.js +++ b/src/support.js @@ -15,7 +15,7 @@ jQuery.support = (function() { // Preliminary tests div.setAttribute( "className", "t" ); - div.innerHTML = "
a"; + div.innerHTML = "
a"; all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; @@ -96,8 +96,8 @@ jQuery.support = (function() { }; // Make sure checked status is properly cloned - input.checked = false; - support.noCloneChecked = !input.cloneNode( true ).checked; + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index e2b00a662..31426e739 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1895,14 +1895,3 @@ test("html() - script exceptions bubble (#11743)", function() { ok( false, "error ignored" ); }, "exception bubbled from remote script" ); }); - -test("checked state is cloned with clone()", function(){ - expect(2); - - var elem = jQuery.parseHTML('')[0]; - elem.checked = false; - equal( jQuery(elem).clone().attr('id','clone')[0].checked, false, 'Checked false state correctly cloned' ); - elem = jQuery.parseHTML('')[0]; - elem.checked = true; - equal( jQuery(elem).clone().attr('id','clone')[0].checked, true, 'Checked true state correctly cloned' ); -}); From 2e42f06cdcefe0e1ecb15d52b16fe41779b0bed9 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 25 Jul 2012 15:23:53 -0400 Subject: [PATCH 14/34] Sizzle: fixes issue with :empty pseudo and comment nodes --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index 14574d0f5..4fc4b92a1 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 14574d0f516f0cc3d2c4c22f9d39d9ea8bf1366e +Subproject commit 4fc4b92a1d1037b70162faf19860c2aac2ae5622 From 3478cbb4d4f59473512891a6ba83158d47f26bf1 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 15:42:06 -0400 Subject: [PATCH 15/34] Remove IE8 testswarm hacks for offset. --- test/unit/offset.js | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/test/unit/offset.js b/test/unit/offset.js index 6d00e8dac..d18bc4bb8 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -218,20 +218,17 @@ testIframe("offset/relative", "relative", function( $ ) { testIframe("offset/static", "static", function( $ ) { // IE is collapsing the top margin of 1px; detect and adjust accordingly - var ie = $("#static-1").offset().top === 6, - swarmy = document.documentMode === 8 && window.location.search.indexOf("swarmURL") >= 0; + var ie = $("#static-1").offset().top === 6; - expect( swarmy? 68 : 80 ); + expect( 80 ); // get offset var tests = [ { "id": "#static-1", "top": ie ? 6 : 7, "left": 7 }, { "id": "#static-1-1", "top": ie ? 13 : 15, "left": 15 }, - { "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 } + { "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 }, + { "id": "#static-2", "top": ie ? 121 : 122, left: 7 } ]; - if ( !swarmy ) { - tests.push({ "id": "#static-2", "top": ie ? 121 : 122, left: 7 }); - } jQuery.each( tests, function() { equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" ); equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset().left" ); @@ -242,12 +239,9 @@ testIframe("offset/static", "static", function( $ ) { tests = [ { "id": "#static-1", "top": ie ? 5 : 6, "left": 6 }, { "id": "#static-1-1", "top": ie ? 12 : 14, "left": 14 }, - { "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 } - + { "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 }, + { "id": "#static-2", "top": ie ? 120 : 121, "left": 6 } ]; - if ( !swarmy ) { - tests.push({ "id": "#static-2", "top": ie ? 120 : 121, "left": 6 }); - } jQuery.each( tests, function() { equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["top"] + "').position().top" ); equal( $( this["id"] ).position().left, this["left"], "jQuery('" + this["left"] +"').position().left" ); @@ -269,15 +263,10 @@ testIframe("offset/static", "static", function( $ ) { { "id": "#static-1-1", "top": -3, "left": -3 }, { "id": "#static-1-1", "top": 14, "left": 14 }, { "id": "#static-1", "top": 30, "left": 30 }, - { "id": "#static-1", "top": 2, "left": 2 } - + { "id": "#static-1", "top": 2, "left": 2 }, + { "id": "#static-1", "top": -2, "left": -2 }, + { "id": "#static-1", "top": 7, "left": 7 } ]; - if ( !swarmy ) { - tests.push( - { "id": "#static-1", "top": -2, "left": -2 }, - { "id": "#static-1", "top": 7, "left": 7 } - ); - } jQuery.each( tests, function() { $( this["id"] ).offset({ "top": this["top"], "left": this["left"] }); equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset({ top: " + this["top"] + " })" ); From 17a26f5bd9b14225248942b876e96545b4c21fb6 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 25 Jul 2012 16:05:48 -0400 Subject: [PATCH 16/34] Fail silently if closest is somehow called on a document. Fixes #10726. --- src/traversing.js | 5 +---- test/unit/traversing.js | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/traversing.js b/src/traversing.js index 321c25197..baac0399e 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -92,16 +92,13 @@ jQuery.fn.extend({ for ( ; i < l; i++ ) { cur = this[i]; - while ( cur ) { + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } else { cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } } } } diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 2712e7f2f..7f9678307 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -275,7 +275,8 @@ test("filter() with positional selectors", function() { }); test("closest()", function() { - expect(13); + expect( 14 ); + deepEqual( jQuery("body").closest("body").get(), q("body"), "closest(body)" ); deepEqual( jQuery("body").closest("html").get(), q("html"), "closest(html)" ); deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" ); @@ -299,6 +300,8 @@ test("closest()", function() { // Bug #7369 equal( jQuery("
").closest("[foo]").length, 1, "Disconnected nodes with attribute selector" ); equal( jQuery("
text
").closest("[lang]").length, 0, "Disconnected nodes with text and non-existent attribute selector" ); + + ok( !jQuery(document).closest("#foo").length, "Calling closest on a document fails silently" ); }); test("closest(jQuery)", function() { From 0f14c53d7217ad65c5dfbb043c96f2683a563540 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 25 Jul 2012 16:09:30 -0400 Subject: [PATCH 17/34] Remove unnecessary else --- src/traversing.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/traversing.js b/src/traversing.js index baac0399e..8685ae017 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -96,10 +96,8 @@ jQuery.fn.extend({ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; - - } else { - cur = cur.parentNode; } + cur = cur.parentNode; } } From 81432c883576ebccdc164704847a7b38c8513bcc Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Wed, 25 Jul 2012 15:18:01 -0500 Subject: [PATCH 18/34] Trying to repair a unit --- test/unit/effects.js | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/test/unit/effects.js b/test/unit/effects.js index 17ba1c21a..a35505884 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1405,25 +1405,29 @@ asyncTest( "jQuery.Animation( object, props, opts )", 4, function() { asyncTest( "Animate Option: step: function( percent, tween )", 1, function() { var counter = {}; - jQuery( "#foo" ).animate({ - prop1: 1, - prop2: 2, - prop3: 3 - }, { - duration: 1, - step: function( value, tween ) { - var calls = counter[ tween.prop ] = counter[ tween.prop ] || []; - calls.push( value ); - } - }).queue( function( next ) { - deepEqual( counter, { - prop1: [0, 1], - prop2: [0, 2], - prop3: [0, 3] - }, "Step function was called once at 0% and once at 100% for each property"); - next(); - start(); - }); + // if the animation loop is already running when we start this test, it WILL fail + // going to try delaying 100ms to make sure any potential leftover animations are done + setTimeout( function() { + jQuery( "#foo" ).animate({ + prop1: 1, + prop2: 2, + prop3: 3 + }, { + duration: 1, + step: function( value, tween ) { + var calls = counter[ tween.prop ] = counter[ tween.prop ] || []; + calls.push( value ); + } + }).queue( function( next ) { + deepEqual( counter, { + prop1: [0, 1], + prop2: [0, 2], + prop3: [0, 3] + }, "Step function was called once at 0% and once at 100% for each property"); + next(); + start(); + }); + }, 100 ); }); asyncTest( "Animate callbacks have correct context", 2, function() { From f0432d54f68c35c63573128263c85217f3cf8d69 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Wed, 25 Jul 2012 15:36:21 -0500 Subject: [PATCH 19/34] This should repair the unit --- src/sizzle | 2 +- test/unit/effects.js | 44 +++++++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/sizzle b/src/sizzle index 4fc4b92a1..e4d50dd01 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 4fc4b92a1d1037b70162faf19860c2aac2ae5622 +Subproject commit e4d50dd01f7573e205606746b32924281db379f0 diff --git a/test/unit/effects.js b/test/unit/effects.js index a35505884..6d200b534 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1405,29 +1405,27 @@ asyncTest( "jQuery.Animation( object, props, opts )", 4, function() { asyncTest( "Animate Option: step: function( percent, tween )", 1, function() { var counter = {}; - // if the animation loop is already running when we start this test, it WILL fail - // going to try delaying 100ms to make sure any potential leftover animations are done - setTimeout( function() { - jQuery( "#foo" ).animate({ - prop1: 1, - prop2: 2, - prop3: 3 - }, { - duration: 1, - step: function( value, tween ) { - var calls = counter[ tween.prop ] = counter[ tween.prop ] || []; - calls.push( value ); - } - }).queue( function( next ) { - deepEqual( counter, { - prop1: [0, 1], - prop2: [0, 2], - prop3: [0, 3] - }, "Step function was called once at 0% and once at 100% for each property"); - next(); - start(); - }); - }, 100 ); + jQuery( "#foo" ).animate({ + prop1: 1, + prop2: 2, + prop3: 3 + }, { + duration: 1, + step: function( value, tween ) { + var calls = counter[ tween.prop ] = counter[ tween.prop ] || []; + // in case this is called multiple times for either, lets store it in + // 0 or 1 in the array + calls[ value === 0 ? 0 : 1 ] = value; + } + }).queue( function( next ) { + deepEqual( counter, { + prop1: [0, 1], + prop2: [0, 2], + prop3: [0, 3] + }, "Step function was called once at 0% and once at 100% for each property"); + next(); + start(); + }); }); asyncTest( "Animate callbacks have correct context", 2, function() { From d00048eabec29c783ca76560340692cda4c677ff Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Wed, 25 Jul 2012 15:53:42 -0500 Subject: [PATCH 20/34] Oops, didn't mean to revert sizzle last time --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index e4d50dd01..4fc4b92a1 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit e4d50dd01f7573e205606746b32924281db379f0 +Subproject commit 4fc4b92a1d1037b70162faf19860c2aac2ae5622 From 5119b252ac2f3391e9f23efef4852095e0d7e6b3 Mon Sep 17 00:00:00 2001 From: Oleg Date: Wed, 25 Jul 2012 16:24:10 -0700 Subject: [PATCH 21/34] Moves isHidden to src/css.js and re-introduces its use. No ticket. Closes gh-876 --- src/css.js | 8 ++++++-- src/effects.js | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/css.js b/src/css.js index d8d5239dd..57edd1507 100644 --- a/src/css.js +++ b/src/css.js @@ -43,6 +43,11 @@ function vendorPropName( style, name ) { return origName; } +function isHidden( elem, el ) { + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ); +} + function showHide( elements, show ) { var elem, display, values = [], @@ -65,8 +70,7 @@ function showHide( elements, show ) { // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element - if ( (elem.style.display === "" && curCSS( elem, "display" ) === "none") || - !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { + if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); } } else { diff --git a/src/effects.js b/src/effects.js index dbca88650..3405cfdc2 100644 --- a/src/effects.js +++ b/src/effects.js @@ -437,11 +437,6 @@ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { } }; -function isHidden( elem, el ) { - elem = el || elem; - return curCSS( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ); -} - jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { From ed898c62c8d3e8c2091592976c181ee4142287ac Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 21:24:49 -0400 Subject: [PATCH 22/34] Fix #12148. Let .toggle() call the public .hide() for punching. There is a slightly shorter way to do this but it's not Closure-friendly. --- src/css.js | 16 +++++++++------- test/unit/css.js | 13 ++++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/css.js b/src/css.js index 57edd1507..744e7a545 100644 --- a/src/css.js +++ b/src/css.js @@ -43,8 +43,7 @@ function vendorPropName( style, name ) { return origName; } -function isHidden( elem, el ) { - elem = el || elem; +function isHidden( elem ) { return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ); } @@ -111,16 +110,19 @@ jQuery.fn.extend({ hide: function() { return showHide( this ); }, - toggle: function( fn, fn2 ) { - var bool = typeof fn === "boolean"; + toggle: function( state, fn2 ) { + var bool = typeof state === "boolean"; - if ( jQuery.isFunction( fn ) && jQuery.isFunction( fn2 ) ) { + if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { return eventsToggle.apply( this, arguments ); } return this.each(function() { - var state = bool ? fn : jQuery( this ).is(":hidden"); - showHide([ this ], state ); + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } }); } }); diff --git a/test/unit/css.js b/test/unit/css.js index 45aee9f06..c2142052a 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -561,7 +561,7 @@ test( "show() resolves correct default display, detached nodes (#10006)", functi }); test("toggle()", function() { - expect(6); + expect(7); var x = jQuery("#foo"); ok( x.is(":visible"), "is visible" ); x.toggle(); @@ -575,6 +575,17 @@ test("toggle()", function() { ok( x.is(":hidden"), "is hidden" ); x.toggle(true); ok( x.is(":visible"), "is visible again" ); + + // Ensure hide() is called when toggled (#12148) + var oldHide = jQuery.fn.hide; + jQuery.fn.hide = function() { + ok( true, name + " method called on toggle" ); + return oldHide.apply( this, arguments ); + }; + x.toggle( name === "show" ); + jQuery.fn.hide = oldHide; + + }); test("hide hidden elements (bug #7141)", function() { From d4ec6804e83b2c060a9fc94a044893751c2f640e Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 21:33:30 -0400 Subject: [PATCH 23/34] Give .stop() queue animations more leeway for Stutterin' Swarmy. This test sometimes fails with only 2 animations left in the queue, so this extends the first animation in case we're running afoul of the one-second rule for background windows. --- test/unit/effects.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/effects.js b/test/unit/effects.js index 6d200b534..806192ea0 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -598,7 +598,7 @@ test("stop() - several in queue", function() { var w = 0; $foo.hide().css( "width", 200 ).css("width"); - $foo.animate({ "width": "show" }, 1000); + $foo.animate({ "width": "show" }, 1500); $foo.animate({ "width": "hide" }, 1000); $foo.animate({ "width": "show" }, 1000); setTimeout(function(){ @@ -612,7 +612,7 @@ test("stop() - several in queue", function() { $foo.stop(true); start(); - }, 100); + }, 200); }); test("stop(clearQueue)", function() { From cc6c014125ad2d6c8a705f0d543069ce5802757e Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 21:44:44 -0400 Subject: [PATCH 24/34] Unbreak isHidden args, they're needed by the .filter() call. --- src/css.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 744e7a545..85c73c090 100644 --- a/src/css.js +++ b/src/css.js @@ -43,7 +43,8 @@ function vendorPropName( style, name ) { return origName; } -function isHidden( elem ) { +function isHidden( elem, el ) { + elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ); } From a475f1aa4dd7ac96fcd80728ce2738386778f343 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 25 Jul 2012 21:58:59 -0400 Subject: [PATCH 25/34] Pull in unit tests from gh-877, thanks @orkel! --- test/unit/css.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/unit/css.js b/test/unit/css.js index c2142052a..dca5a08e0 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -561,8 +561,10 @@ test( "show() resolves correct default display, detached nodes (#10006)", functi }); test("toggle()", function() { - expect(7); - var x = jQuery("#foo"); + expect(9); + var div, + x = jQuery("#foo"); + ok( x.is(":visible"), "is visible" ); x.toggle(); ok( x.is(":hidden"), "is hidden" ); @@ -575,7 +577,12 @@ test("toggle()", function() { ok( x.is(":hidden"), "is hidden" ); x.toggle(true); ok( x.is(":visible"), "is visible again" ); - + + div = jQuery("
").appendTo("#qunit-fixture"); + x = div.find("div"); + strictEqual( x.toggle().css( "display" ), "none", "is hidden" ); + strictEqual( x.toggle().css( "display" ), "block", "is visible" ); + // Ensure hide() is called when toggled (#12148) var oldHide = jQuery.fn.hide; jQuery.fn.hide = function() { @@ -584,8 +591,6 @@ test("toggle()", function() { }; x.toggle( name === "show" ); jQuery.fn.hide = oldHide; - - }); test("hide hidden elements (bug #7141)", function() { From 155855b2a9bd95219871210ae7dcacd2a5f7e117 Mon Sep 17 00:00:00 2001 From: Daniel Chatfield Date: Wed, 25 Jul 2012 22:23:24 -0400 Subject: [PATCH 26/34] Fix #12127, fer real. IE9/10 check state on clone. Close gh-875. --- AUTHORS.txt | 1 + src/manipulation.js | 5 ++--- test/unit/manipulation.js | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 774d11b32..51200abaf 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -129,3 +129,4 @@ David Benjamin Uri Gilad Chris Faulkner Elijah Manor +Daniel Chatfield diff --git a/src/manipulation.js b/src/manipulation.js index 212eaf6bb..d1dcb3768 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -455,9 +455,8 @@ function cloneFixAttributes( src, dest ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set - if ( src.checked ) { - dest.defaultChecked = dest.checked = src.checked; - } + + dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 31426e739..4038f1a74 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1895,3 +1895,15 @@ test("html() - script exceptions bubble (#11743)", function() { ok( false, "error ignored" ); }, "exception bubbled from remote script" ); }); + +test("checked state is cloned with clone()", function(){ + expect(2); + + var elem = jQuery.parseHTML("")[0]; + elem.checked = false; + equal( jQuery(elem).clone().attr("id","clone")[0].checked, false, "Checked false state correctly cloned" ); + + elem = jQuery.parseHTML("")[0]; + elem.checked = true; + equal( jQuery(elem).clone().attr("id","clone")[0].checked, true, "Checked true state correctly cloned" ); +}); From 0a1be437ff78d957e32d8493287c1041fed8cbb7 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Wed, 25 Jul 2012 21:33:48 -0500 Subject: [PATCH 27/34] Adding a check for double progress call in effects units --- test/unit/effects.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/effects.js b/test/unit/effects.js index 806192ea0..4353e1566 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1770,6 +1770,10 @@ asyncTest("Animation callbacks (#11797)", 15, function() { ok( true, "async: start" ); }, progress: function( anim, percent ) { + // occasionally the progress handler is called twice in first frame.... *shrug* + if ( percent === 0 && expectedProgress === 1 ) { + return; + } equal( percent, expectedProgress, "async: progress " + expectedProgress ); // once at 0, once at 1 expectedProgress++; From 14f67a95189422f83f5e9e19ed7b2d636da717b9 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Thu, 26 Jul 2012 09:28:56 -0400 Subject: [PATCH 28/34] Per @gibson042, don't need .documentElement since Sizzle handles. --- src/css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 85c73c090..dcba720e5 100644 --- a/src/css.js +++ b/src/css.js @@ -45,7 +45,7 @@ function vendorPropName( style, name ) { function isHidden( elem, el ) { elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem ); + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { From e02e61ca87e58beb8a05708b686bca74e54a07dd Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Thu, 26 Jul 2012 22:26:25 -0400 Subject: [PATCH 29/34] Tagging the 1.8rc1 release. --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 505f6f1bf..4836ae41a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.8pre \ No newline at end of file +1.8rc1 \ No newline at end of file From d71b8b2db79b13a11c605a32bd5b336aea800003 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Thu, 26 Jul 2012 22:30:55 -0400 Subject: [PATCH 30/34] Updating the source version to 1.8pre --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 4836ae41a..505f6f1bf 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.8rc1 \ No newline at end of file +1.8pre \ No newline at end of file From f6f25eff88a818a352f447196ec64777ef07d362 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Fri, 27 Jul 2012 16:10:30 -0400 Subject: [PATCH 31/34] Sizzle: adjust pseudos regex. Fixes #12153. --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index 4fc4b92a1..60c254995 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 4fc4b92a1d1037b70162faf19860c2aac2ae5622 +Subproject commit 60c254995a01a57c33a36b90ccc4b5a34a98c9d2 From 4039d3668decade6c7098f7f270c45dd54ff6a8c Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Fri, 27 Jul 2012 17:34:39 -0400 Subject: [PATCH 32/34] Sizzle: fix a small bug with combinator cache. Fixes #10499. --- src/sizzle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sizzle b/src/sizzle index 60c254995..a0523a509 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 60c254995a01a57c33a36b90ccc4b5a34a98c9d2 +Subproject commit a0523a50942971b41af6aba39b39ee81c1fc5f8a From e07b444dfe87f26f0d6031920026142425505ad6 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Fri, 27 Jul 2012 18:19:01 -0400 Subject: [PATCH 33/34] Fix a regression where has with multiple contexts was not filtering correctly. Test added. --- src/traversing.js | 6 +++--- test/unit/traversing.js | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/traversing.js b/src/traversing.js index 8685ae017..4c58ae0b8 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -48,12 +48,12 @@ jQuery.fn.extend({ }, has: function( target ) { - var i = 0, + var i, targets = jQuery( target, this ), - l = targets.length; + len = targets.length; return this.filter(function() { - for ( ; i < l; i++ ) { + for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 7f9678307..e7d519662 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -376,7 +376,7 @@ test("has(Element)", function() { }); test("has(Selector)", function() { - expect(4); + expect( 5 ); var obj = jQuery("#qunit-fixture").has("#sndp"); deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have any element matching the selector as a descendant" ); @@ -385,7 +385,10 @@ test("has(Selector)", function() { deepEqual( detached.has("i").get(), detached.get(), "...Even when detached" ); var multipleParent = jQuery("#qunit-fixture, #header").has("#sndp"); - deepEqual( obj.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" ); + deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" ); + + multipleParent = jQuery("#select1, #select2, #select3").has("#option1a, #option3a"); + deepEqual( multipleParent.get(), q("select1", "select3"), "Multiple contexts are checks correctly" ); var multipleHas = jQuery("#qunit-fixture").has("#sndp, #first"); deepEqual( multipleHas.get(), q("qunit-fixture"), "Only adds elements once" ); From beeab4d126b303b194899adf579d8f43e3fd5e69 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Mon, 30 Jul 2012 10:44:47 -0400 Subject: [PATCH 34/34] Quote reserved keyword 'throws' to satisfy yui compressor. Fixes #12158. --- src/ajax.js | 2 +- src/manipulation.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index 304a41d48..f3887ff44 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -861,7 +861,7 @@ function ajaxConvert( s, response ) { if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { + if ( conv && s["throws"] ) { response = conv( response ); } else { try { diff --git a/src/manipulation.js b/src/manipulation.js index d1dcb3768..3cfc97c3b 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -362,7 +362,7 @@ jQuery.fn.extend({ dataType: "script", async: false, global: false, - throws: true + "throws": true }); } else { jQuery.error("no ajax");