From c5264ce196c2f6d60b9d662a160f8e146c9aa23c Mon Sep 17 00:00:00 2001 From: louisremi Date: Wed, 23 Feb 2011 15:53:29 +0100 Subject: [PATCH 01/80] fix the regular expression that turns camel-case properties to lower-case ones for IE9. Fixes #8346 --- src/css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 8a982312f..86a5c71a1 100644 --- a/src/css.js +++ b/src/css.js @@ -3,7 +3,7 @@ var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rdashAlpha = /-([a-z])/ig, - rupper = /([A-Z])/g, + rupper = /([A-Z]|^ms)/g, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/, From e27fcf42ce152ede15c8617bb5d31dfb2088470c Mon Sep 17 00:00:00 2001 From: louisremi Date: Wed, 23 Feb 2011 15:55:13 +0100 Subject: [PATCH 02/80] comments for workarounds are always welcome. --- src/css.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css.js b/src/css.js index 86a5c71a1..04e205eb4 100644 --- a/src/css.js +++ b/src/css.js @@ -3,6 +3,7 @@ var ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rdashAlpha = /-([a-z])/ig, + // fixed for IE9, see #8346 rupper = /([A-Z]|^ms)/g, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/, From 55ec6a71d2378a5301af71c2c0080e15289c3f78 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Fri, 4 Mar 2011 21:16:40 -0500 Subject: [PATCH 03/80] Fixes #7340. Use a single capturing handler to simulate bubbling focusin/focusout event on non-IE browsers. Allow native DOM methods to fire events other than the currently active one back into jQuery. --- src/event.js | 32 +++++++++++++++++++++++--------- test/unit/event.js | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/event.js b/src/event.js index f7e0a08c0..61c8a93fd 100644 --- a/src/event.js +++ b/src/event.js @@ -70,10 +70,10 @@ jQuery.event = { } if ( !eventHandle ) { - elemData.handle = eventHandle = function() { + elemData.handle = eventHandle = function( e ) { // Handle the second event of a trigger and when // an event is called after a page has unloaded - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.handle.apply( eventHandle.elem, arguments ) : undefined; }; @@ -380,7 +380,7 @@ jQuery.event = { target[ "on" + targetType ] = null; } - jQuery.event.triggered = true; + jQuery.event.triggered = event.type; target[ targetType ](); } @@ -391,7 +391,7 @@ jQuery.event = { target[ "on" + targetType ] = old; } - jQuery.event.triggered = false; + jQuery.event.triggered = undefined; } } }, @@ -868,19 +868,33 @@ function trigger( type, elem, args ) { // Create "bubbling" focus and blur events if ( document.addEventListener ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0; + jQuery.event.special[ fix ] = { setup: function() { - this.addEventListener( orig, handler, true ); + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } }, teardown: function() { - this.removeEventListener( orig, handler, true ); + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } } }; - function handler( e ) { - e = jQuery.event.fix( e ); + function handler( donor ) { + // Donor event is always a native one; fix it and switch its type. + // Let focusin/out handler cancel the donor focus/blur event. + var e = jQuery.event.fix( donor ); e.type = fix; - return jQuery.event.handle.call( this, e ); + e.originalEvent = {}; + jQuery.event.trigger( e, null, e.target ); + if ( e.isDefaultPrevented() ) { + donor.preventDefault(); + } } }); } diff --git a/test/unit/event.js b/test/unit/event.js index b7b260462..d54987923 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1966,6 +1966,31 @@ test("window resize", function() { ok( !jQuery._data(window, "__events__"), "Make sure all the events are gone." ); }); +test("focusin bubbles", function() { + expect(4); + + var input = jQuery( '' ).prependTo( "body" ), + order = 0; + + jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){ + equals( 1, order++, "focusin on the body second" ); + }); + + input.bind( "focusin.focusinBubblesTest", function(){ + equals( 0, order++, "focusin on the element first" ); + }); + + // DOM focus method + input[0].focus(); + // jQuery trigger, which calls DOM focus + order = 0; + input[0].blur(); + input.trigger( "focus" ); + + input.remove(); + jQuery( "body" ).unbind( "focusin.focusinBubblesTest" ); +}); + /* test("jQuery(function($) {})", function() { stop(); From 5c2d70979c15bbda5c90e1634abe11d8c350abcb Mon Sep 17 00:00:00 2001 From: Jordan Boesch Date: Sat, 5 Mar 2011 09:30:29 -0600 Subject: [PATCH 04/80] bug 6158; fixing replaceWith from throwing errors on empty elements --- src/manipulation.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/manipulation.js b/src/manipulation.js index ba3169715..a4a81de44 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -261,6 +261,9 @@ jQuery.fn.extend({ } }); } else { + if ( !this.length ) { + return this; + } return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); } }, From c9ef09c800ba7b6510d9e3a68f053ae29409f621 Mon Sep 17 00:00:00 2001 From: Jordan Boesch Date: Sat, 5 Mar 2011 09:46:12 -0600 Subject: [PATCH 05/80] bug 6158; fixing replaceWith from throwing errors on non existant elements --- src/manipulation.js | 7 +++---- test/unit/manipulation.js | 7 +++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/manipulation.js b/src/manipulation.js index a4a81de44..613faabb9 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -261,10 +261,9 @@ jQuery.fn.extend({ } }); } else { - if ( !this.length ) { - return this; - } - return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); + return ( this.length ) ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; } }, diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 34425ed3a..1169032ce 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -739,7 +739,7 @@ test("insertAfter(String|Element|Array<Element>|jQuery)", function() { }); var testReplaceWith = function(val) { - expect(20); + expect(21); jQuery('#yahoo').replaceWith(val( 'buga' )); ok( jQuery("#replace")[0], 'Replace element with string' ); ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' ); @@ -799,6 +799,9 @@ var testReplaceWith = function(val) { var set = jQuery("
").replaceWith(val("test")); equals( set[0].nodeName.toLowerCase(), "span", "Replace the disconnected node." ); equals( set.length, 1, "Replace the disconnected node." ); + + var non_existant = jQuery('#does-not-exist').replaceWith( val("should not throw an error") ); + equals( non_existant.length, 0, "Length of non existant element." ) var $div = jQuery("
").appendTo("body"); // TODO: Work on jQuery(...) inline script execution @@ -827,7 +830,7 @@ test("replaceWith(String|Element|Array<Element>|jQuery)", function() { test("replaceWith(Function)", function() { testReplaceWith(functionReturningObj); - expect(21); + expect(22); var y = jQuery("#yahoo")[0]; From dd100bf5ac56d5d44afe45d73fe1824bd0135872 Mon Sep 17 00:00:00 2001 From: Jordan Boesch Date: Sat, 5 Mar 2011 09:59:25 -0600 Subject: [PATCH 06/80] bug 6158; fixing replaceWith from throwing errors on non existant elements; fixing semicolon --- test/unit/manipulation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 1169032ce..ff3dff164 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -799,9 +799,9 @@ var testReplaceWith = function(val) { var set = jQuery("
").replaceWith(val("test")); equals( set[0].nodeName.toLowerCase(), "span", "Replace the disconnected node." ); equals( set.length, 1, "Replace the disconnected node." ); - + var non_existant = jQuery('#does-not-exist').replaceWith( val("should not throw an error") ); - equals( non_existant.length, 0, "Length of non existant element." ) + equals( non_existant.length, 0, "Length of non existant element." ); var $div = jQuery("
").appendTo("body"); // TODO: Work on jQuery(...) inline script execution From 2ac4067a639856a6035c3bd00aab132c9714b52d Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 9 Mar 2011 22:38:26 -0500 Subject: [PATCH 07/80] Fixes #8456. Make sure parent is not null before crawling into its lap, so mouseenter is triggered on a mouseover event. --- src/event.js | 2 +- test/unit/event.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/event.js b/src/event.js index f7e0a08c0..2620646da 100644 --- a/src/event.js +++ b/src/event.js @@ -661,7 +661,7 @@ var withinElement = function( event ) { // Chrome does something similar, the parentNode property // can be accessed but is null. - if ( parent !== document && !parent.parentNode ) { + if ( parent && parent !== document && !parent.parentNode ) { return; } // Traverse up the tree diff --git a/test/unit/event.js b/test/unit/event.js index b7b260462..d66aaac9b 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -683,6 +683,20 @@ test("hover()", function() { equals( times, 4, "hover handlers fired" ); }); +test("mouseover triggers mouseenter", function() { + expect(1); + + var count = 0, + elem = jQuery(""); + elem.mouseenter(function () { + count++; + }); + elem.trigger('mouseover'); + equals(count, 1, "make sure mouseover triggers a mouseenter" ); + + elem.remove(); +}); + test("trigger() shortcuts", function() { expect(6); From 515c56f9c6394a4ddadf29c55867f71dec6dcdb7 Mon Sep 17 00:00:00 2001 From: JessThrysoee Date: Fri, 11 Mar 2011 00:17:38 +0100 Subject: [PATCH 08/80] Make it possible to force the Ajax crossDomain option to false. --- src/ajax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index 4714afdae..66b26cd70 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -310,6 +310,7 @@ jQuery.extend({ contentType: "application/x-www-form-urlencoded", processData: true, async: true, + crossDomain: null, /* timeout: 0, data: null, @@ -319,7 +320,6 @@ jQuery.extend({ cache: null, traditional: false, headers: {}, - crossDomain: null, */ accepts: { @@ -604,7 +604,7 @@ jQuery.extend({ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); // Determine if a cross-domain request is in order - if ( !s.crossDomain ) { + if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || From 11c26b3cc9bf84f93d34f45056d29a446baeb6c9 Mon Sep 17 00:00:00 2001 From: JessThrysoee Date: Fri, 11 Mar 2011 17:46:59 +0100 Subject: [PATCH 09/80] no need to specifically initialize crossDomain to null --- src/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 66b26cd70..4290e295c 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -310,7 +310,6 @@ jQuery.extend({ contentType: "application/x-www-form-urlencoded", processData: true, async: true, - crossDomain: null, /* timeout: 0, data: null, @@ -320,6 +319,7 @@ jQuery.extend({ cache: null, traditional: false, headers: {}, + crossDomain: null, */ accepts: { From 124acbfbc523614dc5835cfce2c82b867a59986f Mon Sep 17 00:00:00 2001 From: Jordan Boesch Date: Mon, 14 Mar 2011 14:17:02 -0600 Subject: [PATCH 10/80] removing parens --- src/manipulation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manipulation.js b/src/manipulation.js index 613faabb9..27f81cc24 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -261,7 +261,7 @@ jQuery.fn.extend({ } }); } else { - return ( this.length ) ? + return this.length ? this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : this; } From 714ae379db9dcb704c04080196a05d13a028f7a4 Mon Sep 17 00:00:00 2001 From: jaubourg Date: Tue, 15 Mar 2011 19:20:03 +0100 Subject: [PATCH 11/80] Fixes #8509. Makes URL regexp less overzealous and ensures it recognizes URL schemes which do not contain a conformant hierarchical structure ( as per section 2.1.2 of http://www.ietf.org/rfc/rfc2718.txt ). Also adds about: and adobe air's app: and app-storage: to the list of local protocols and provides a failover in case document.location is illformed. Unit test added. --- src/ajax.js | 6 +++--- test/unit/ajax.js | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index 4714afdae..add3b3738 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 = /(?:^file|^widget|\-extension):$/, + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, @@ -19,7 +19,7 @@ var r20 = /%20/g, rucHeadersFunc = function( _, $1, $2 ) { return $1 + $2.toUpperCase(); }, - rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?|\/[^\/])/, + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, // Keep a copy of the old load method _load = jQuery.fn.load, @@ -61,7 +61,7 @@ try { } // Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ); +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 2a2ac46a1..7c572a32c 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -492,7 +492,7 @@ test(".ajax() - hash", function() { test("jQuery ajax - cross-domain detection", function() { - expect( 5 ); + expect( 6 ); var loc = document.location, otherPort = loc.port === 666 ? 667 : 666, @@ -508,6 +508,7 @@ test("jQuery ajax - cross-domain detection", function() { }); jQuery.ajax({ + dataType: "jsonp", url: 'app:/path', beforeSend: function( _ , s ) { ok( s.crossDomain , "Adobe AIR app:/ URL detected as cross-domain" ); @@ -533,6 +534,15 @@ test("jQuery ajax - cross-domain detection", function() { } }); + jQuery.ajax({ + dataType: "jsonp", + url: "about:blank", + beforeSend: function( _ , s ) { + ok( s.crossDomain , "Test about:blank is detected as cross-domain" ); + return false; + } + }); + jQuery.ajax({ dataType: "jsonp", url: loc.protocol + "//" + loc.host, From 150d3decb54971a7378fb48d0b6970d3fb50ff95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Tue, 15 Mar 2011 20:16:09 +0100 Subject: [PATCH 12/80] Introduce submodules, closes #8536 Instead of the manual clone of sizzle and qunit, use git submodules instead. this will ensure that all future releases can be recreated by checking out an tag. --- .gitignore | 2 -- .gitmodules | 6 ++++++ Makefile | 34 ++++------------------------------ src/sizzle | 1 + test/qunit | 1 + 5 files changed, 12 insertions(+), 32 deletions(-) create mode 100644 .gitmodules create mode 160000 src/sizzle create mode 160000 test/qunit diff --git a/.gitignore b/.gitignore index a77d67a96..6cd547974 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,5 @@ dist *~ *.diff *.patch -test/qunit -src/sizzle /*.html .DS_Store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..80ce23688 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "src/sizzle"] + path = src/sizzle + url = git://github.com/jeresig/sizzle.git +[submodule "test/qunit"] + path = test/qunit + url = git://github.com/jquery/qunit.git diff --git a/Makefile b/Makefile index a6aae4253..e0d1da716 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -V ?= 0 - SRC_DIR = src TEST_DIR = test BUILD_DIR = build @@ -38,7 +36,6 @@ JQ = ${DIST_DIR}/jquery.js JQ_MIN = ${DIST_DIR}/jquery.min.js SIZZLE_DIR = ${SRC_DIR}/sizzle -QUNIT_DIR = ${TEST_DIR}/qunit JQ_VER = $(shell cat version.txt) VER = sed "s/@VERSION/${JQ_VER}/" @@ -51,32 +48,8 @@ all: jquery min lint ${DIST_DIR}: @@mkdir -p ${DIST_DIR} -ifeq ($(strip $(V)),0) -verbose = --quiet -else ifeq ($(strip $(V)),1) -verbose = -else -verbose = --verbose -endif - -define clone_or_pull --@@if test ! -d $(strip ${1})/.git; then \ - echo "Cloning $(strip ${1})..."; \ - git clone $(strip ${verbose}) --depth=1 $(strip ${2}) $(strip ${1}); \ - else \ - echo "Pulling $(strip ${1})..."; \ - git --git-dir=$(strip ${1})/.git pull $(strip ${verbose}) origin master; \ - fi - -endef - -${QUNIT_DIR}: - $(call clone_or_pull, ${QUNIT_DIR}, git://github.com/jquery/qunit.git) - -${SIZZLE_DIR}: - $(call clone_or_pull, ${SIZZLE_DIR}, git://github.com/jeresig/sizzle.git) - -init: ${QUNIT_DIR} ${SIZZLE_DIR} +init: + @@if [ -d .git ]; then git submodule update --init --recursive; fi jquery: init ${JQ} jq: init ${JQ} @@ -122,7 +95,8 @@ clean: @@echo "Removing built copy of Sizzle" @@rm -f src/selector.js - @@echo "Removing cloned directories" +distclean: clean + @@echo "Removing submodules" @@rm -rf test/qunit src/sizzle .PHONY: all jquery lint min init jq clean diff --git a/src/sizzle b/src/sizzle new file mode 160000 index 000000000..ef19279f5 --- /dev/null +++ b/src/sizzle @@ -0,0 +1 @@ +Subproject commit ef19279f54ba49242c6461d47577c703f4f4e80e diff --git a/test/qunit b/test/qunit new file mode 160000 index 000000000..d404faf8f --- /dev/null +++ b/test/qunit @@ -0,0 +1 @@ +Subproject commit d404faf8f587fcbe6b8907943022e6318dd51e0c From cd2ca7b5918b3cedfed497ac7d86bfd2c5f92a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Tue, 15 Mar 2011 21:25:51 +0100 Subject: [PATCH 13/80] pull submodules make command Adding an helper funciton to pull the latest from all registered submodules --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index e0d1da716..7b67f7aff 100644 --- a/Makefile +++ b/Makefile @@ -99,4 +99,9 @@ distclean: clean @@echo "Removing submodules" @@rm -rf test/qunit src/sizzle +# update the submodules to the latest at the most logical branch +pull_submodules: + @@git submodule foreach "git pull origin \$$(git branch --no-color --contains \$$(git rev-parse HEAD) | grep -v \( | head -1)" + @@git submodule summary + .PHONY: all jquery lint min init jq clean From bd4468886d97edfb53342e1a10acb300d081ed27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Tue, 15 Mar 2011 21:42:58 +0100 Subject: [PATCH 14/80] adding pull command --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 7b67f7aff..84816a19e 100644 --- a/Makefile +++ b/Makefile @@ -104,4 +104,7 @@ pull_submodules: @@git submodule foreach "git pull origin \$$(git branch --no-color --contains \$$(git rev-parse HEAD) | grep -v \( | head -1)" @@git submodule summary +pull: pull_submodules + @@git pull ${REMOTE} ${BRANCH} + .PHONY: all jquery lint min init jq clean From 51abb3dc071fd86afd346ec5c340734f5c61064f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Fri, 4 Mar 2011 23:33:20 +0100 Subject: [PATCH 15/80] Changing dependice order for minify to prevent reminify unless jquery.js has been updated, no minification should occur closes: #8519 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 84816a19e..7b87c9f51 100644 --- a/Makefile +++ b/Makefile @@ -75,9 +75,9 @@ lint: jquery echo "You must have NodeJS installed in order to test jQuery against JSLint."; \ fi -min: ${JQ_MIN} +min: jquery ${JQ_MIN} -${JQ_MIN}: jquery +${JQ_MIN}: ${JQ} @@if test ! -z ${JS_ENGINE}; then \ echo "Minifying jQuery" ${JQ_MIN}; \ ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \ From a2faed347de389d6f667a4e98576398db88d1a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 17 Mar 2011 19:50:53 +0100 Subject: [PATCH 16/80] Merge when updating submodules on make When running make, the submodule update will remove all local changes. Adding flag --rebase or --merge does solve the issue. rebase will probably make it cleaner, but it might stop on conflict, thus --merge will result in fewer (probably none). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 84816a19e..525d3a197 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ ${DIST_DIR}: @@mkdir -p ${DIST_DIR} init: - @@if [ -d .git ]; then git submodule update --init --recursive; fi + @@if [ -d .git ]; then git submodule update --init --recursive --merge; fi jquery: init ${JQ} jq: init ${JQ} From 22738e0e4b988f8ce2cb341b137ba0fe4646d3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 17 Mar 2011 20:15:44 +0100 Subject: [PATCH 17/80] Remove jq target remove obsolete jq target --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 525d3a197..3223b8da4 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,6 @@ init: @@if [ -d .git ]; then git submodule update --init --recursive --merge; fi jquery: init ${JQ} -jq: init ${JQ} ${JQ}: ${MODULES} | ${DIST_DIR} @@echo "Building" ${JQ} From 4f9e78616ecd9ca403a25ee0e3dc71781484e553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 17 Mar 2011 20:14:15 +0100 Subject: [PATCH 18/80] Change makefile order to only update submodules on 'all' target insterad of always update the submodules, now only "make all" will run that, thus an "make jquery" will not update them --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3223b8da4..9ef44cff1 100644 --- a/Makefile +++ b/Makefile @@ -42,16 +42,13 @@ VER = sed "s/@VERSION/${JQ_VER}/" DATE=$(shell git log -1 --pretty=format:%ad) -all: jquery min lint +all: update_submodules jquery min lint @@echo "jQuery build complete." ${DIST_DIR}: @@mkdir -p ${DIST_DIR} -init: - @@if [ -d .git ]; then git submodule update --init --recursive --merge; fi - -jquery: init ${JQ} +jquery: ${JQ} ${JQ}: ${MODULES} | ${DIST_DIR} @@echo "Building" ${JQ} @@ -98,6 +95,10 @@ distclean: clean @@echo "Removing submodules" @@rm -rf test/qunit src/sizzle +# change pointers for submodules and update them to what is specified in jQuery +update_submodules: + @@if [ -d .git ]; then git submodule update --init --recursive --merge; fi + # update the submodules to the latest at the most logical branch pull_submodules: @@git submodule foreach "git pull origin \$$(git branch --no-color --contains \$$(git rev-parse HEAD) | grep -v \( | head -1)" From b4acb7ae819563c3b75bbdabfaf2662fd24b06e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 17 Mar 2011 20:16:19 +0100 Subject: [PATCH 19/80] updating phony rules --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ef44cff1..d377c4cf6 100644 --- a/Makefile +++ b/Makefile @@ -107,4 +107,4 @@ pull_submodules: pull: pull_submodules @@git pull ${REMOTE} ${BRANCH} -.PHONY: all jquery lint min init jq clean +.PHONY: all jquery lint min clean distclean update_submodules pull_submodules pull From e2dd8916eef1daba1a56a5ff1fbb44cb3385f4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 17 Mar 2011 20:26:45 +0100 Subject: [PATCH 20/80] Adding core target Adding core target to do jquery, minimization and lint --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d377c4cf6..99e742d6c 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,9 @@ VER = sed "s/@VERSION/${JQ_VER}/" DATE=$(shell git log -1 --pretty=format:%ad) -all: update_submodules jquery min lint +all: update_submodules core + +core: jquery min lint @@echo "jQuery build complete." ${DIST_DIR}: @@ -107,4 +109,4 @@ pull_submodules: pull: pull_submodules @@git pull ${REMOTE} ${BRANCH} -.PHONY: all jquery lint min clean distclean update_submodules pull_submodules pull +.PHONY: all jquery lint min clean distclean update_submodules pull_submodules pull core From 8a1156da9b835d826bfb4b82c41bcdd0d87aff05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 17 Mar 2011 20:40:07 +0100 Subject: [PATCH 21/80] merge doesn't work when init sadly the merge strategy doesn't work when doing an initial clone, circumvent that --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 99e742d6c..2c7bb8085 100644 --- a/Makefile +++ b/Makefile @@ -98,8 +98,16 @@ distclean: clean @@rm -rf test/qunit src/sizzle # change pointers for submodules and update them to what is specified in jQuery +# --merge doesn't work when doing an initial clone, thus test if we have non-existing +# submodules, then do an real update update_submodules: - @@if [ -d .git ]; then git submodule update --init --recursive --merge; fi + @@if [ -d .git ]; then \ + if git submodule status | grep -q -E '^-'; then \ + git submodule update --init --recursive; \ + else \ + git submodule update --init --recursive --merge; \ + fi; \ + fi; # update the submodules to the latest at the most logical branch pull_submodules: From c3c507e900fceb419628157504004ab2813b7d01 Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Thu, 24 Mar 2011 15:41:46 -0400 Subject: [PATCH 22/80] Added css hook to work around bug in WebKit computed margin-right. Fixes #3333 - .css("marginRight") is incorrect in WebKit --- src/css.js | 19 +++++++++++++++++++ src/support.js | 14 +++++++++++++- test/unit/css.js | 12 ++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 8a982312f..d6b488139 100644 --- a/src/css.js +++ b/src/css.js @@ -240,6 +240,25 @@ if ( !jQuery.support.opacity ) { }; } +jQuery(function() { + // This hook cannot be added until DOM ready because the support test + // for it is not run until after DOM ready + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + var ret = "0px", + display = elem.style.display; + elem.style.display = "inline-block"; + ret = getComputedStyle( elem, "margin-right", "margin-right" ); + elem.style.display = display; + return ret; + } + } + } +}); + if ( document.defaultView && document.defaultView.getComputedStyle ) { getComputedStyle = function( elem, newName, name ) { var ret, defaultView, computedStyle; diff --git a/src/support.js b/src/support.js index 7470b33e8..939ad4fcb 100644 --- a/src/support.js +++ b/src/support.js @@ -67,7 +67,8 @@ boxModel: null, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, - reliableHiddenOffsets: true + reliableHiddenOffsets: true, + reliableMarginRight: true }; input.checked = true; @@ -188,6 +189,17 @@ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; div.innerHTML = ""; + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( document.defaultView && document.defaultView.getComputedStyle ) { + div.style.width = "1px"; + div.style.marginRight = "0"; + jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div).marginRight, 10) || 0 ) === 0; + } + body.removeChild( div ).style.display = "none"; div = tds = null; }); diff --git a/test/unit/css.js b/test/unit/css.js index 555f13575..8ae8fcb34 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -333,3 +333,15 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () { ok( result, "elem.runtimeStyle does not throw exception" ); }); + +test("marginRight computed style (bug #3333)", function() { + expect(1); + + var $div = jQuery("#foo"); + $div.css({ + width: "1px", + marginRight: 0 + }); + + equals($div.css("marginRight"), "0px"); +}); From e8f4629b924cae0b0f1847d2368031f06bc08149 Mon Sep 17 00:00:00 2001 From: Michael Murray Date: Thu, 24 Mar 2011 19:02:38 -0400 Subject: [PATCH 23/80] Offset setter for fixed position elements in Webkit. Fixes #8316. --- src/offset.js | 4 ++-- test/unit/offset.js | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/offset.js b/src/offset.js index 1003c400c..18261bb57 100644 --- a/src/offset.js +++ b/src/offset.js @@ -181,10 +181,10 @@ jQuery.offset = { curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1), + calculatePosition = ((position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1), props = {}, curPosition = {}, curTop, curLeft; - // need to be able to calculate position if either top or left is auto and position is absolute + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); } diff --git a/test/unit/offset.js b/test/unit/offset.js index 329d69f95..b7f72a0cd 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -422,6 +422,21 @@ test("offsetParent", function(){ equals( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." ); }); +testoffset("bug_8316", function( jQuery ){ + expect(2); + + var tests = [ + { id:'#elem', top: 100, left: 100 } + ]; + + jQuery.each(tests, function(){ + var el = jQuery(this.id); + el.offset({ top: this.top, left: this.left}); + equals(Math.round(el.offset().top), this.top); + equals(Math.round(el.offset().left), this.left); + }); +}); + function testoffset(name, fn) { test(name, function() { @@ -447,7 +462,7 @@ function testoffset(name, fn) { function loadFixture() { var src = './data/offset/' + name + '.html?' + parseInt( Math.random()*1000, 10 ), iframe = jQuery('