From 75655e5758bc786989f26a98b09aabbfb88f66fd Mon Sep 17 00:00:00 2001 From: Sylvester Keil Date: Sat, 15 Jan 2011 13:56:20 +0100 Subject: [PATCH 01/26] Use parseFloat instead of parseInt to read CSS values. This fixes #7730 and #7885. --- src/offset.js | 8 +++++--- test/unit/offset.js | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/offset.js b/src/offset.js index 2040c9d8..94b67c77 100644 --- a/src/offset.js +++ b/src/offset.js @@ -187,11 +187,13 @@ jQuery.offset = { // need to be able to calculate position if either top or left is auto and position is absolute if ( calculatePosition ) { curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; } - curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; - curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; - if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } diff --git a/test/unit/offset.js b/test/unit/offset.js index cfa14449..1f8c3b15 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -422,6 +422,32 @@ test("offsetParent", function(){ equals( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." ); }); +test("fractions (see #7730 and #7885)", function() { + expect(2); + + jQuery('body').append('
'); + + var expected = { top: 1000, left: 1000 }; + var div = jQuery('#fractions'); + + div.css({ + position: 'absolute', + left: '1000.7432222px', + top: '1000.532325px', + width: 100, + height: 100 + }); + + div.offset(expected); + + var result = div.offset(); + + equals( result.top, expected.top, "Check top" ); + equals( result.left, expected.left, "Check left" ); + + div.remove(); +}); + function testoffset(name, fn) { test(name, function() { From 025f2c63e487e069215b2a03ded2b98198904af9 Mon Sep 17 00:00:00 2001 From: louisremi Date: Tue, 1 Mar 2011 00:54:15 +0100 Subject: [PATCH 02/26] fixing both #8403 and #8401: jQuery \"bulldozes\" other IE filters when setting opacity --- src/css.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/css.js b/src/css.js index 8a982312..9fdba3b7 100644 --- a/src/css.js +++ b/src/css.js @@ -221,7 +221,8 @@ if ( !jQuery.support.opacity ) { }, set: function( elem, value ) { - var style = elem.style; + var style = elem.style, + currentStyle = elem.currentStyle; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level @@ -231,11 +232,11 @@ if ( !jQuery.support.opacity ) { var opacity = jQuery.isNaN(value) ? "" : "alpha(opacity=" + value * 100 + ")", - filter = style.filter || ""; + filter = currentStyle && currentStyle.filter || style.filter || ""; style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : - style.filter + ' ' + opacity; + filter + ' ' + opacity; } }; } From c6b891fb1c909a2791ba7a4d745940858bd7b94f Mon Sep 17 00:00:00 2001 From: louisremi Date: Mon, 7 Mar 2011 14:43:08 +0100 Subject: [PATCH 03/26] Adding unit tests for #8403 --- test/data/testsuite.css | 2 +- test/unit/css.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/data/testsuite.css b/test/data/testsuite.css index cffaaa46..02900681 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -1,5 +1,5 @@ /* for testing opacity set in styles in IE */ -ol#empty { opacity: 0; filter:Alpha(opacity=0); } +ol#empty { opacity: 0; filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff'); } div#fx-tests h4 { background: red; diff --git a/test/unit/css.js b/test/unit/css.js index 555f1357..87466187 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1,7 +1,7 @@ module("css", { teardown: moduleTeardown }); test("css(String|Hash)", function() { - expect(41); + expect(42); equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"'); @@ -58,6 +58,7 @@ test("css(String|Hash)", function() { equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" ); jQuery('#empty').css({ opacity: '1' }); equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ); + ok( ~jQuery('#empty')[0].currentStyle.filter.indexOf('gradient'), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild'); From 50e8837207bbfb251af33280b8ef333f16c18e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Tue, 22 Mar 2011 23:18:15 +0100 Subject: [PATCH 04/26] Makefile: pull_submodules cleaning Empirical testing confirms that pulling the url again is enough --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2c7bb808..b9fa6188 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ update_submodules: # 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 foreach "git pull \$$(git config remote.origin.url)" @@git submodule summary pull: pull_submodules From 3296116041ea0eb89e123c24cf092e34ccb3f380 Mon Sep 17 00:00:00 2001 From: Jordan Boesch Date: Wed, 30 Mar 2011 11:17:48 -0600 Subject: [PATCH 05/26] Bug 4366; fixing $.each(document.styleSheets) from throwing errors in IE --- src/core.js | 7 +++++-- test/unit/core.js | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core.js b/src/core.js index 9312ee28..1b06913c 100644 --- a/src/core.js +++ b/src/core.js @@ -610,8 +610,11 @@ jQuery.extend({ } } } else { - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } } } diff --git a/test/unit/core.js b/test/unit/core.js index 6ee8724d..39b7d275 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -784,7 +784,7 @@ test("jQuery.extend(Object, Object)", function() { }); test("jQuery.each(Object,Function)", function() { - expect(13); + expect(14); jQuery.each( [0,1,2], function(i, n){ equals( i, n, "Check array iteration" ); }); @@ -816,6 +816,13 @@ test("jQuery.each(Object,Function)", function() { f[i] = 'baz'; }); equals( "baz", f.foo, "Loop over a function" ); + + var stylesheet_count = 0; + jQuery.each(document.styleSheets, function(i){ + stylesheet_count++; + }); + equals(stylesheet_count, 2, "should not throw an error in IE while looping over document.styleSheets and return proper amount"); + }); test("jQuery.makeArray", function(){ From 926884bf1f071b6dd92f0611d905b2cbffa16a19 Mon Sep 17 00:00:00 2001 From: Jordan Boesch Date: Wed, 30 Mar 2011 11:26:20 -0600 Subject: [PATCH 06/26] Bug 4366; removing extra space --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index 1b06913c..7cf99372 100644 --- a/src/core.js +++ b/src/core.js @@ -611,7 +611,7 @@ jQuery.extend({ } } else { for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { break; } } From 4b0c26f0af96da05ab1a0166268c2925a6e6e6ac Mon Sep 17 00:00:00 2001 From: rwldrn Date: Tue, 5 Apr 2011 18:12:50 -0400 Subject: [PATCH 07/26] Ticket #8777 undelegate by namespace --- src/event.js | 13 +++++++++++-- test/unit/event.js | 34 ++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/event.js b/src/event.js index bc2cf76e..6fac59c7 100644 --- a/src/event.js +++ b/src/event.js @@ -868,10 +868,10 @@ 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() { if ( attaches++ === 0 ) { @@ -1027,6 +1027,14 @@ jQuery.each(["live", "die"], function( i, name ) { return this; } + if ( name === "die" && !types && + origSelector && origSelector[0] === "." ) { + + context.unbind( origSelector ); + + return this; + } + if ( jQuery.isFunction( data ) ) { fn = data; data = undefined; @@ -1184,3 +1192,4 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl }); })( jQuery ); + diff --git a/test/unit/event.js b/test/unit/event.js index 2a6d8a66..cc6901ff 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -685,7 +685,7 @@ test("hover()", function() { test("mouseover triggers mouseenter", function() { expect(1); - + var count = 0, elem = jQuery(""); elem.mouseenter(function () { @@ -693,7 +693,7 @@ test("mouseover triggers mouseenter", function() { }); elem.trigger('mouseover'); equals(count, 1, "make sure mouseover triggers a mouseenter" ); - + elem.remove(); }); @@ -1956,6 +1956,27 @@ test("delegate with submit", function() { jQuery(document).undelegate(); }); +test("undelegate() with only namespaces", function(){ + expect(2); + + var $delegate = jQuery("#liveHandlerOrder"), + count = 0; + + $delegate.delegate("a", "click.ns", function(e) { + count++; + }); + + jQuery("a", $delegate).eq(0).trigger("click.ns"); + + equals( count, 1, "delegated click.ns"); + + $delegate.undelegate(".ns"); + + jQuery("a", $delegate).eq(1).trigger("click.ns"); + + equals( count, 1, "no more .ns after undelegate"); +}); + test("Non DOM element events", function() { expect(1); @@ -1982,8 +2003,8 @@ test("window resize", function() { test("focusin bubbles", function() { expect(5); - - var input = jQuery( '' ).prependTo( "body" ), + + var input = jQuery( '' ).prependTo( "body" ), order = 0; jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){ @@ -1996,12 +2017,12 @@ test("focusin bubbles", function() { // DOM focus method input[0].focus(); - + // To make the next focus test work, we need to take focus off the input. // This will fire another focusin event, so set order to reflect that. order = 1; jQuery("#text1")[0].focus(); - + // jQuery trigger, which calls DOM focus order = 0; input.trigger( "focus" ); @@ -2027,3 +2048,4 @@ test("event properties", function() { }).click(); }); */ + From 467747d55f9fa38bfdacc7908dd396859206f2d7 Mon Sep 17 00:00:00 2001 From: Rob Morgan Date: Mon, 11 Apr 2011 12:24:38 +0800 Subject: [PATCH 08/26] Fixing typos in the README.md file --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 17b38de6..dfc3b9af 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ As the source code is handled by the version control system Git, it's useful to ### Submodules ### -The repository uses submodules, which normally are handles directly by the Makefile, but sometimes you want to +The repository uses submodules, which normally are handled directly by the Makefile, but sometimes you want to be able to work with them manually. Following are the steps to manually get the submodules: @@ -86,7 +86,7 @@ If you want to work inside a submodule, it is possible, but first you need to ch 1. `cd src/sizzle` 2. `git checkout master` -After you've commited your changes to the submodule, you'll update the jquery project to point to the new commit, +After you've committed your changes to the submodule, you'll update the jquery project to point to the new commit, but remember to push the submodule changes before pushing the new jquery commit: 1. `cd src/sizzle` @@ -99,12 +99,12 @@ The makefile has some targets to simplify submodule handling: #### `make update_submodules` #### -checks out the commit pointed to byu jquery, but merges your local changes, if any. This target is executed +checks out the commit pointed to by jquery, but merges your local changes, if any. This target is executed when you are doing a normal `make`. #### `make pull_submodules` #### -updates the content of the submoduels to what is probably the latest upstream code +updates the content of the submodules to what is probably the latest upstream code #### `make pull` #### From 91d039881310bab4c56b89d2b3c0b8bfd9200297 Mon Sep 17 00:00:00 2001 From: Rob Morgan Date: Mon, 11 Apr 2011 12:32:45 +0800 Subject: [PATCH 09/26] Adding a full-stop --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfc3b9af..5d147a55 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ when you are doing a normal `make`. #### `make pull_submodules` #### -updates the content of the submodules to what is probably the latest upstream code +updates the content of the submodules to what is probably the latest upstream code. #### `make pull` #### From 3411d47a6a952e283864d2401438a6764d925b74 Mon Sep 17 00:00:00 2001 From: jaubourg Date: Mon, 11 Apr 2011 13:40:14 +0200 Subject: [PATCH 10/26] Adds _mark and _unmark as a mean to keep track of ongoing non-queued animations in fn.promise. --- src/effects.js | 17 +++++-- src/queue.js | 102 +++++++++++++++++++++++++++-------------- test/unit/queue.js | 111 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 188 insertions(+), 42 deletions(-) diff --git a/src/effects.js b/src/effects.js index ad2ed3c9..d6eff7b3 100644 --- a/src/effects.js +++ b/src/effects.js @@ -118,13 +118,17 @@ jQuery.fn.extend({ var optall = jQuery.speed(speed, easing, callback); if ( jQuery.isEmptyObject( prop ) ) { - return this.each( optall.complete ); + return this.each( optall.complete, [ false ] ); } return this[ optall.queue === false ? "each" : "queue" ](function() { // XXX 'this' does not always have a nodeName when running the // test suite + if ( optall.queue === false ) { + jQuery._mark( this ); + } + var opt = jQuery.extend({}, optall), p, isElement = this.nodeType === 1, hidden = isElement && jQuery(this).is(":hidden"), @@ -234,6 +238,10 @@ jQuery.fn.extend({ } this.each(function() { + // clear marker counters if we know they won't be + if ( !gotoEnd ) { + jQuery._unmark( true, this ); + } // go in reverse order so anything added to the queue during the loop is ignored for ( var i = timers.length - 1; i >= 0; i-- ) { if ( timers[i].elem === this ) { @@ -295,10 +303,13 @@ jQuery.extend({ // Queueing opt.old = opt.complete; - opt.complete = function() { + opt.complete = function( noUnmark ) { if ( opt.queue !== false ) { - jQuery(this).dequeue(); + jQuery.dequeue( this ); + } else if ( noUnmark !== false ) { + jQuery._unmark( this ); } + if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } diff --git a/src/queue.js b/src/queue.js index 701d06ad..ab06ae92 100644 --- a/src/queue.js +++ b/src/queue.js @@ -1,32 +1,74 @@ (function( jQuery ) { +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery.data( elem, deferDataKey, undefined, true ); + if ( defer && + ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && + ( src === "mark " || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery.data( elem, queueDataKey, undefined, true ) && + !jQuery.data( elem, markDataKey, undefined, true ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.resolve(); + } + }, 0 ); + } +} + jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = (type || "fx") + "mark"; + jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + + if ( elem ) { + type = type || "fx"; + + var key = type + "mark", + count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); + + if ( count ) { + jQuery.data( elem, key, count, true ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + queue: function( elem, type, data ) { - if ( !elem ) { - return; + if ( elem ) { + type = (type || "fx") + "queue"; + var q = jQuery.data( elem, type, undefined, true ) || []; + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q.length || jQuery.isArray(data) ) { + q = jQuery.data( elem, type, jQuery.makeArray(data), true ); + } else { + q.push( data ); + } + } + return q; } - - type = (type || "fx") + "queue"; - var q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { - return q || []; - } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; }, dequeue: function( elem, type ) { - type = type || "fx"; - var queue = jQuery.queue( elem, type ), fn = queue.shift(), defer; @@ -50,17 +92,7 @@ jQuery.extend({ if ( !queue.length ) { jQuery.removeData( elem, type + "queue", true ); - // Look if we have observers and resolve if needed - if (( defer = jQuery.data( elem, type + "defer", undefined, true ) )) { - // Give room for hard-coded callbacks to fire first - // and eventually add another animation on the element - setTimeout( function() { - if ( !jQuery.data( elem, type + "queue", undefined, true ) ) { - jQuery.removeData( elem, type + "defer", true ); - defer.resolve(); - } - }, 0 ); - } + handleQueueMarkDefer( elem, type, "queue" ); } } }); @@ -120,7 +152,8 @@ jQuery.fn.extend({ i = elements.length, count = 1, deferDataKey = type + "defer", - queueDataKey = type + "queue"; + queueDataKey = type + "queue", + markDataKey = type + "mark"; function resolve() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); @@ -128,7 +161,8 @@ jQuery.fn.extend({ } while( i-- ) { if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - jQuery.data( elements[ i ], queueDataKey, undefined, true ) && + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { count++; tmp.done( resolve ); diff --git a/test/unit/queue.js b/test/unit/queue.js index 31e587db..05461cd2 100644 --- a/test/unit/queue.js +++ b/test/unit/queue.js @@ -1,10 +1,17 @@ module("queue", { teardown: moduleTeardown }); test("queue() with other types",function() { - expect(9); + expect(11); var counter = 0; - var $div = jQuery({}); + stop(); + + var $div = jQuery({}), + defer; + + $div.promise('foo').done(function() { + equals( counter, 0, "Deferred for collection with no queue is automatically resolved" ); + }); $div .queue('foo',function(){ @@ -22,6 +29,11 @@ test("queue() with other types",function() { equals( ++counter, 4, "Dequeuing" ); }); + defer = $div.promise('foo').done(function() { + equals( counter, 4, "Testing previous call to dequeue in deferred" ); + start(); + }); + equals( $div.queue('foo').length, 4, "Testing queue length" ); $div.dequeue('foo'); @@ -74,7 +86,7 @@ test("queue(name) passes in the next item in the queue as a parameter", function }); test("queue() passes in the next item in the queue as a parameter to fx queues", function() { - expect(2); + expect(3); stop(); var div = jQuery({}); @@ -87,11 +99,15 @@ test("queue() passes in the next item in the queue as a parameter to fx queues", }).queue(function(next) { equals(++counter, 2, "Next was called"); next(); - start(); }).queue("bar", function() { equals(++counter, 3, "Other queues are not triggered by next()") }); + jQuery.when( div.promise("fx"), div ).done(function() { + equals(counter, 2, "Deferreds resolved"); + start(); + }); + }); test("delay()", function() { @@ -110,7 +126,9 @@ test("delay()", function() { }); test("clearQueue(name) clears the queue", function() { - expect(1); + expect(2); + + stop() var div = jQuery({}); var counter = 0; @@ -123,6 +141,11 @@ test("clearQueue(name) clears the queue", function() { counter++; }); + div.promise("foo").done(function() { + ok( true, "dequeue resolves the deferred" ); + start(); + }); + div.dequeue("foo"); equals(counter, 1, "the queue was cleared"); @@ -146,3 +169,81 @@ test("clearQueue() clears the fx queue", function() { div.removeData(); }); + +test("_mark() and _unmark()", function() { + expect(1); + + var div = {}, + $div = jQuery( div ); + + stop(); + + jQuery._mark( div, "foo" ); + jQuery._mark( div, "foo" ); + jQuery._unmark( div, "foo" ); + jQuery._unmark( div, "foo" ); + + $div.promise( "foo" ).done(function() { + ok( true, "No more marks" ); + start(); + }); +}); + +test("_mark() and _unmark() default to 'fx'", function() { + expect(1); + + var div = {}, + $div = jQuery( div ); + + stop(); + + jQuery._mark( div ); + jQuery._mark( div ); + jQuery._unmark( div, "fx" ); + jQuery._unmark( div ); + + $div.promise().done(function() { + ok( true, "No more marks" ); + start(); + }); +}); + +test("promise()", function() { + expect(1); + + stop(); + + var objects = []; + + jQuery.each( [{}, {}], function( i, div ) { + var $div = jQuery( div ); + $div.queue(function( next ) { + setTimeout( function() { + if ( i ) { + next(); + setTimeout( function() { + jQuery._unmark( div ); + }, 20 ); + } else { + jQuery._unmark( div ); + setTimeout( function() { + next(); + }, 20 ); + } + }, 50 ); + }).queue(function( next ) { + next(); + }); + jQuery._mark( div ); + objects.push( $div ); + }); + + jQuery.when.apply( jQuery, objects ).done(function() { + ok( true, "Deferred resolved" ); + start(); + }); + + jQuery.each( objects, function() { + this.dequeue(); + }); +}); From 6591f6dd9d1c86144903f60e5d19e624c5bf6751 Mon Sep 17 00:00:00 2001 From: jeresig Date: Mon, 11 Apr 2011 11:22:52 -0400 Subject: [PATCH 11/26] Fix broken merge. --- test/unit/traversing.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 6228a0b9..f622082e 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -223,10 +223,6 @@ test("closest(Array)", function() { same( jQuery("body").closest(["span","html"]), [{selector:"html", elem:document.documentElement, level:2}], "closest([body, html])" ); }); -<<<<<<< HEAD -test("not(Selector|undefined)", function() { - expect(11); -======= test("closest(jQuery)", function() { expect(8); var $child = jQuery("#nothiddendivchild"), @@ -243,9 +239,8 @@ test("closest(jQuery)", function() { ok( $child.closest( $body.add($parent) ).is('#nothiddendiv'), "Closest ancestor retrieved." ); }); -test("not(Selector)", function() { - expect(7); ->>>>>>> 1a167767305202797cf4c839eb64bd7adfb00182 +test("not(Selector|undefined)", function() { + expect(11); equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" ); same( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" ); same( jQuery("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" ); From 868e1e28ce7cee543e0e47ec2261b44c4c686f99 Mon Sep 17 00:00:00 2001 From: Rick Waldon Date: Mon, 11 Apr 2011 11:32:23 -0400 Subject: [PATCH 12/26] Ticket #8753 Always set event type explicitly --- src/event.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/event.js b/src/event.js index ac0da6b7..249e81ff 100644 --- a/src/event.js +++ b/src/event.js @@ -304,7 +304,7 @@ jQuery.event = { } event.namespace = namespaces.join("."); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); - + // Handle a global trigger if ( !elem ) { // Don't bubble custom events when global (to avoid too much overhead) @@ -574,6 +574,9 @@ jQuery.Event = function( src ) { } } + // Always ensure a type has been explicitly set + this.type = src.type; + // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || @@ -1033,7 +1036,7 @@ jQuery.each(["live", "die"], function( i, name ) { if ( data === false || jQuery.isFunction( data ) ) { fn = data || returnFalse; data = undefined; - } + } types = (types || "").split(" "); From eb857e2b714e6786078cf8641941f267a6e19fa0 Mon Sep 17 00:00:00 2001 From: timmywil Date: Mon, 11 Apr 2011 11:54:55 -0400 Subject: [PATCH 13/26] Fix unit tests in firefox 4 and opera 11, passing null or undefined to indexOf was throwing an error in those browsers --- src/traversing.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/traversing.js b/src/traversing.js index fb5946bb..485de56d 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -298,13 +298,18 @@ jQuery.extend({ // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); - } else if ( qualifier && qualifier.nodeType ) { + } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return (elem === qualifier) === keep; }); From a564a0b1ec167b2f0fdd2d017a986b226a9850f6 Mon Sep 17 00:00:00 2001 From: timmywil Date: Mon, 11 Apr 2011 12:24:31 -0400 Subject: [PATCH 14/26] Run order problem when running full test suite in Opera 11, removed failing test as it passed by itself and there are others just like it --- src/traversing.js | 4 ++-- test/unit/traversing.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/traversing.js b/src/traversing.js index 485de56d..e0f40151 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -73,9 +73,9 @@ jQuery.fn.extend({ }, is: function( selector ) { - return !!selector && (typeof selector === "string" ? + return !!selector && ( typeof selector === "string" ? jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0); + this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { diff --git a/test/unit/traversing.js b/test/unit/traversing.js index f622082e..140b337a 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -72,7 +72,7 @@ test("is(String|undefined)", function() { }); test("is(jQuery)", function() { - expect(24); + expect(23); ok( jQuery('#form').is( jQuery('form') ), 'Check for element: A form is a form' ); ok( !jQuery('#form').is( jQuery('div') ), 'Check for element: A form is not a div' ); ok( jQuery('#mark').is( jQuery('.blog') ), 'Check for class: Expected class "blog"' ); @@ -83,7 +83,6 @@ test("is(jQuery)", function() { ok( !jQuery('#en').is( jQuery('[lang="de"]') ), 'Check for attribute: Expected attribute lang to be "en", not "de"' ); ok( jQuery('#text1').is( jQuery('[type="text"]') ), 'Check for attribute: Expected attribute type to be "text"' ); ok( !jQuery('#text1').is( jQuery('[type="radio"]') ), 'Check for attribute: Expected attribute type to be "text", not "radio"' ); - ok( jQuery('#text2').is( jQuery(':disabled') ), 'Check for pseudoclass: Expected to be disabled' ); ok( !jQuery('#text1').is( jQuery(':disabled') ), 'Check for pseudoclass: Expected not disabled' ); ok( jQuery('#radio2').is( jQuery(':checked') ), 'Check for pseudoclass: Expected to be checked' ); ok( !jQuery('#radio1').is( jQuery(':checked') ), 'Check for pseudoclass: Expected not checked' ); From 272b8d69dcff771ffdb61ccd33c4e83eaea8ca50 Mon Sep 17 00:00:00 2001 From: louisremi Date: Mon, 11 Apr 2011 20:33:52 +0200 Subject: [PATCH 15/26] replace cssPropsAware branch --- src/css.js | 16 +++++++++++----- test/unit/css.js | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/css.js b/src/css.js index 65ec20f5..d53a1f63 100644 --- a/src/css.js +++ b/src/css.js @@ -123,10 +123,16 @@ jQuery.extend({ css: function( elem, name, extra ) { // Make sure that we're working with the right name - var ret, origName = jQuery.camelCase( name ), - hooks = jQuery.cssHooks[ origName ]; + var ret, + hooks; - name = jQuery.cssProps[ origName ] || origName; + name = jQuery.camelCase( name ); + hooks = jQuery.cssHooks[ name ]; + name = jQuery.cssProps[ name ] || name; + // cssFloat needs a special treatment + if ( name === 'cssFloat' ) { + name = 'float'; + } // If a hook was provided get the computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { @@ -134,7 +140,7 @@ jQuery.extend({ // Otherwise, if a way to get the computed value exists, use that } else if ( curCSS ) { - return curCSS( elem, name, origName ); + return curCSS( elem, name ); } }, @@ -273,7 +279,7 @@ jQuery(function() { }); if ( document.defaultView && document.defaultView.getComputedStyle ) { - getComputedStyle = function( elem, newName, name ) { + getComputedStyle = function( elem, name ) { var ret, defaultView, computedStyle; name = name.replace( rupper, "-$1" ).toLowerCase(); diff --git a/test/unit/css.js b/test/unit/css.js index 08f50ef2..904312be 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -377,3 +377,17 @@ test("marginRight computed style (bug #3333)", function() { equals($div.css("marginRight"), "0px"); }); + +test("jQuery.cssProps behavior, (bug #8402)", function() { + var div = jQuery( "
" ).appendTo(document.body).css({ + position: "absolute", + top: 0, + left: 10 + }); + jQuery.cssProps.top = "left"; + equal( div.css("top"), "10px", "the fixed property is used when accessing the computed style"); + div.css("top", "100px"); + equal( div[0].style.left, "100px", "the fixed property is used when setting the style"); + // cleanup jQuery.cssProps + jQuery.cssProps.top = undefined; +}); \ No newline at end of file From 6ddc3816dd23fd0d3b9328b2cb4648589884a206 Mon Sep 17 00:00:00 2001 From: louisremi Date: Mon, 11 Apr 2011 21:05:15 +0200 Subject: [PATCH 16/26] limit this test to browsers not supporting opacity --- test/unit/css.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/css.js b/test/unit/css.js index 87466187..c85f432f 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1,7 +1,7 @@ module("css", { teardown: moduleTeardown }); test("css(String|Hash)", function() { - expect(42); + expect( jQuery.support.opacity ? 41 : 42 ); equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"'); @@ -58,7 +58,9 @@ test("css(String|Hash)", function() { equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" ); jQuery('#empty').css({ opacity: '1' }); equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ); - ok( ~jQuery('#empty')[0].currentStyle.filter.indexOf('gradient'), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); + if ( !jQuery.support.opacity ) { + ok( ~jQuery('#empty')[0].currentStyle.filter.indexOf('gradient'), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); + } var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild'); From d7104422017b26eb7bdbf4fc325ab16d561c40ce Mon Sep 17 00:00:00 2001 From: louisremi Date: Mon, 11 Apr 2011 21:14:41 +0200 Subject: [PATCH 17/26] the expected number of assertions shouldn't contain a condition --- test/unit/css.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/css.js b/test/unit/css.js index c85f432f..c21beb80 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1,7 +1,7 @@ module("css", { teardown: moduleTeardown }); test("css(String|Hash)", function() { - expect( jQuery.support.opacity ? 41 : 42 ); + expect( 42 ); equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"'); @@ -58,9 +58,9 @@ test("css(String|Hash)", function() { equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" ); jQuery('#empty').css({ opacity: '1' }); equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ); - if ( !jQuery.support.opacity ) { + jQuery.support.opacity ? + ok(true, "Requires the same number of tests"): ok( ~jQuery('#empty')[0].currentStyle.filter.indexOf('gradient'), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); - } var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild'); From 930731ba0fbf8d2fc21e77283e3a8c332ac44570 Mon Sep 17 00:00:00 2001 From: louisremi Date: Mon, 11 Apr 2011 21:33:15 +0200 Subject: [PATCH 18/26] Double quote is the new simple quote --- test/unit/css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/css.js b/test/unit/css.js index c21beb80..d68aff85 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -60,7 +60,7 @@ test("css(String|Hash)", function() { equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" ); jQuery.support.opacity ? ok(true, "Requires the same number of tests"): - ok( ~jQuery('#empty')[0].currentStyle.filter.indexOf('gradient'), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); + ok( ~jQuery("#empty")[0].currentStyle.filter.indexOf("gradient"), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" ); var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild'); From 581fa824200448361be534680a920d8144476aa7 Mon Sep 17 00:00:00 2001 From: louisremi Date: Mon, 11 Apr 2011 21:44:29 +0200 Subject: [PATCH 19/26] double quotes, again --- src/css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css.js b/src/css.js index 9fdba3b7..e2c31c81 100644 --- a/src/css.js +++ b/src/css.js @@ -236,7 +236,7 @@ if ( !jQuery.support.opacity ) { style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : - filter + ' ' + opacity; + filter + " " + opacity; } }; } From 2b70893928035d53f46575003197e4a1fa52a844 Mon Sep 17 00:00:00 2001 From: jaubourg Date: Tue, 12 Apr 2011 01:09:35 +0200 Subject: [PATCH 20/26] Bug fixes in queue.js: type in dequeue could be undefined which lead to a wrong data key, which would then have undesirable data left dangling on elements. Also adds missing semicolon in effects unit. --- src/queue.js | 19 +++++++------------ test/unit/effects.js | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/queue.js b/src/queue.js index ab06ae92..ce230542 100644 --- a/src/queue.js +++ b/src/queue.js @@ -7,7 +7,7 @@ function handleQueueMarkDefer( elem, type, src ) { defer = jQuery.data( elem, deferDataKey, undefined, true ); if ( defer && ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && - ( src === "mark " || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { + ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { // Give room for hard-coded callbacks to fire first // and eventually mark/queue something else on the element setTimeout( function() { @@ -35,13 +35,10 @@ jQuery.extend({ elem = force; force = false; } - if ( elem ) { type = type || "fx"; - var key = type + "mark", count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); - if ( count ) { jQuery.data( elem, key, count, true ); } else { @@ -54,21 +51,22 @@ jQuery.extend({ queue: function( elem, type, data ) { if ( elem ) { type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type, undefined, true ) || []; - + var q = jQuery.data( elem, type, undefined, true ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { - if ( !q.length || jQuery.isArray(data) ) { + if ( !q || jQuery.isArray(data) ) { q = jQuery.data( elem, type, jQuery.makeArray(data), true ); } else { q.push( data ); } } - return q; + return q || []; } }, dequeue: function( elem, type ) { + type = type || "fx"; + var queue = jQuery.queue( elem, type ), fn = queue.shift(), defer; @@ -107,7 +105,7 @@ jQuery.fn.extend({ if ( data === undefined ) { return jQuery.queue( this[0], type ); } - return this.each(function( i ) { + return this.each(function() { var queue = jQuery.queue( this, type, data ); if ( type === "fx" && queue[0] !== "inprogress" ) { @@ -120,7 +118,6 @@ jQuery.fn.extend({ jQuery.dequeue( this, type ); }); }, - // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { @@ -134,11 +131,9 @@ jQuery.fn.extend({ }, time ); }); }, - clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, - // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, object ) { diff --git a/test/unit/effects.js b/test/unit/effects.js index 4f678511..71a81eef 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -807,7 +807,7 @@ jQuery.checkState = function(){ jQuery.removeData(this, 'olddisplay', true); start(); -} +}; // Chaining Tests test("Chain fadeOut fadeIn", function() { From cb659c6054851dfcc52069885e7b7c0d17ee7097 Mon Sep 17 00:00:00 2001 From: timmywil Date: Mon, 11 Apr 2011 19:30:20 -0400 Subject: [PATCH 21/26] retrieving list with getAttribute is fine, no need to add list here anymore --- src/attributes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/attributes.js b/src/attributes.js index c34cd619..5ccbf2cd 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -479,7 +479,7 @@ jQuery.each([ "selected", "checked", "readOnly", "disabled" ], function( i, name // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height", "list" ], function( i, name ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); From 98da6b13bcc77dc117c68686ef4ed305bd83d400 Mon Sep 17 00:00:00 2001 From: timmywil Date: Mon, 11 Apr 2011 23:59:12 -0400 Subject: [PATCH 22/26] Fixes unit/css.js test fail in Safari 5. support.js test was passing erroneously due to the body to which the div was attached having a width of 0 --- src/support.js | 9 ++++++--- test/unit/css.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/support.js b/src/support.js index 34960505..6b19c083 100644 --- a/src/support.js +++ b/src/support.js @@ -8,6 +8,7 @@ jQuery.support = (function() { select, opt, input, + marginDiv, support, fragment, body, @@ -190,10 +191,12 @@ jQuery.support = (function() { // 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"; + marginDiv = document.createElement('div'); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.appendChild( marginDiv ); support.reliableMarginRight = - ( parseInt( document.defaultView.getComputedStyle(div).marginRight, 10 ) || 0 ) === 0; + ( parseInt( document.defaultView.getComputedStyle( marginDiv ).marginRight, 10 ) || 0 ) === 0; } // Remove the body element we added diff --git a/test/unit/css.js b/test/unit/css.js index 08f50ef2..b94c6a8d 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -375,5 +375,5 @@ test("marginRight computed style (bug #3333)", function() { marginRight: 0 }); - equals($div.css("marginRight"), "0px"); + equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block"); }); From 1299e89dcd803ee0ed48622c716dc3d4c8567cb7 Mon Sep 17 00:00:00 2001 From: Azatoth Date: Tue, 12 Apr 2011 00:17:07 -0400 Subject: [PATCH 23/26] QUnit test for overriding important css declarations, references #4427 --- test/data/testsuite.css | 4 ++++ test/unit/css.js | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/data/testsuite.css b/test/data/testsuite.css index cffaaa46..7df76834 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -109,3 +109,7 @@ div#show-tests * { display: none; } #nothiddendiv { font-size: 16px; } #nothiddendivchild.em { font-size: 2em; } #nothiddendivchild.prct { font-size: 150%; } + +div.isimportant { + background-color: rgb(255, 255, 255) !important; +} diff --git a/test/unit/css.js b/test/unit/css.js index b94c6a8d..4578b197 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -377,3 +377,18 @@ test("marginRight computed style (bug #3333)", function() { equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block"); }); + +test("$().css override !important css declarations (bug #4427)", function(){ + expect(4); + var div = jQuery("
", { + "class": "isimportant" // background-color: #fff !important + }); + div.css("backgroundColor", "rgb(0, 255, 0)"); + equals( div.css("backgroundColor"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + equals( div.css("background-color"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + + div.css("background-color", "rgb(0, 255, 0)"); + equals( div.css("backgroundColor"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + equals( div.css("background-color"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + +}); From 7bfb6a7dd315f0eda3e5227f7d41e38f66f46549 Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 12 Apr 2011 00:29:52 -0400 Subject: [PATCH 24/26] Removing un-needed frameElement check as discussed in #8018. Fixes #8108. --- src/event.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/event.js b/src/event.js index 1d923627..7d5a1097 100644 --- a/src/event.js +++ b/src/event.js @@ -24,17 +24,6 @@ jQuery.event = { return; } - // TODO :: Use a try/catch until it's safe to pull this out (likely 1.6) - // Minor release fix for bug #8018 - try { - // For whatever reason, IE has trouble passing the window object - // around, causing it to be cloned in the process - if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { - elem = window; - } - } - catch ( e ) {} - if ( handler === false ) { handler = returnFalse; } else if ( !handler ) { From 0ff4c69929572e107624139851add5c9a5ec28c6 Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 12 Apr 2011 00:38:48 -0400 Subject: [PATCH 25/26] Some minor code cleanup. --- src/css.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/css.js b/src/css.js index 40e59a85..8b0fda00 100644 --- a/src/css.js +++ b/src/css.js @@ -122,16 +122,16 @@ jQuery.extend({ }, css: function( elem, name, extra ) { - // Make sure that we're working with the right name - var ret, - hooks; + var ret, hooks; + // Make sure that we're working with the right name name = jQuery.camelCase( name ); hooks = jQuery.cssHooks[ name ]; name = jQuery.cssProps[ name ] || name; + // cssFloat needs a special treatment - if ( name === 'cssFloat' ) { - name = 'float'; + if ( name === "cssFloat" ) { + name = "float"; } // If a hook was provided get the computed value from there From 312df0441b16981dd697d74fcbc1e1f212b47b7e Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 12 Apr 2011 00:54:12 -0400 Subject: [PATCH 26/26] Revert "QUnit test for overriding important css declarations, references #4427" This reverts commit 1299e89dcd803ee0ed48622c716dc3d4c8567cb7. Conflicts: test/unit/css.js --- test/data/testsuite.css | 4 ---- test/unit/css.js | 15 --------------- 2 files changed, 19 deletions(-) diff --git a/test/data/testsuite.css b/test/data/testsuite.css index d029b871..02900681 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -109,7 +109,3 @@ div#show-tests * { display: none; } #nothiddendiv { font-size: 16px; } #nothiddendivchild.em { font-size: 2em; } #nothiddendivchild.prct { font-size: 150%; } - -div.isimportant { - background-color: rgb(255, 255, 255) !important; -} diff --git a/test/unit/css.js b/test/unit/css.js index cd2019fe..ff45762c 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -381,21 +381,6 @@ test("marginRight computed style (bug #3333)", function() { equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block"); }); -test("$().css override !important css declarations (bug #4427)", function(){ - expect(4); - var div = jQuery("
", { - "class": "isimportant" // background-color: #fff !important - }); - div.css("backgroundColor", "rgb(0, 255, 0)"); - equals( div.css("backgroundColor"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); - equals( div.css("background-color"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); - - div.css("background-color", "rgb(0, 255, 0)"); - equals( div.css("backgroundColor"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); - equals( div.css("background-color"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); - -}); - test("jQuery.cssProps behavior, (bug #8402)", function() { var div = jQuery( "
" ).appendTo(document.body).css({ position: "absolute",