merge with master and resolve more conflicts
This commit is contained in:
commit
a5604aedb7
19 changed files with 322 additions and 87 deletions
2
Makefile
2
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
|
||||
|
|
|
@ -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` ####
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -613,8 +613,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
27
src/css.js
27
src/css.js
|
@ -122,11 +122,17 @@ 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;
|
||||
// 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 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 );
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -231,7 +237,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
|
||||
|
@ -241,11 +248,15 @@ 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) :
|
||||
<<<<<<< HEAD
|
||||
style.filter + " " + opacity;
|
||||
=======
|
||||
filter + " " + opacity;
|
||||
>>>>>>> 312df0441b16981dd697d74fcbc1e1f212b47b7e
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -273,7 +284,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();
|
||||
|
|
17
src/effects.js
vendored
17
src/effects.js
vendored
|
@ -121,13 +121,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"),
|
||||
|
@ -237,6 +241,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 ) {
|
||||
|
@ -298,10 +306,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 );
|
||||
}
|
||||
|
|
26
src/event.js
26
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 ) {
|
||||
|
@ -304,7 +293,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 +563,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 ||
|
||||
|
@ -1030,10 +1022,18 @@ jQuery.each(["live", "die"], function( i, name ) {
|
|||
return this;
|
||||
}
|
||||
|
||||
if ( name === "die" && !types &&
|
||||
origSelector && origSelector[0] === "." ) {
|
||||
|
||||
context.unbind( origSelector );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
if ( data === false || jQuery.isFunction( data ) ) {
|
||||
fn = data || returnFalse;
|
||||
data = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
types = (types || "").split(" ");
|
||||
|
||||
|
|
|
@ -186,11 +186,13 @@ jQuery.offset = {
|
|||
// 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();
|
||||
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 );
|
||||
}
|
||||
|
|
95
src/queue.js
95
src/queue.js
|
@ -1,27 +1,67 @@
|
|||
(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({
|
||||
queue: function( elem, type, data ) {
|
||||
if ( !elem ) {
|
||||
return;
|
||||
|
||||
_mark: function( elem, type ) {
|
||||
if ( elem ) {
|
||||
type = (type || "fx") + "mark";
|
||||
jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
|
||||
}
|
||||
},
|
||||
|
||||
type = (type || "fx") + "queue";
|
||||
var q = jQuery._data( elem, type );
|
||||
_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" );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Speed up dequeue by getting out quickly if this is just a lookup
|
||||
if ( !data ) {
|
||||
queue: function( elem, type, data ) {
|
||||
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 || jQuery.isArray(data) ) {
|
||||
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
|
||||
} else {
|
||||
q.push( 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 ) {
|
||||
|
@ -50,17 +90,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" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -75,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" ) {
|
||||
|
@ -88,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 ) {
|
||||
|
@ -102,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 ) {
|
||||
|
@ -120,7 +147,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 +156,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 );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ) {
|
||||
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -818,7 +818,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" );
|
||||
});
|
||||
|
@ -850,6 +850,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(){
|
||||
|
|
|
@ -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,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" );
|
||||
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");
|
||||
|
||||
|
@ -375,5 +378,19 @@ 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");
|
||||
});
|
||||
|
||||
test("jQuery.cssProps behavior, (bug #8402)", function() {
|
||||
var div = jQuery( "<div>" ).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;
|
||||
});
|
||||
|
|
2
test/unit/effects.js
vendored
2
test/unit/effects.js
vendored
|
@ -807,7 +807,7 @@ jQuery.checkState = function(){
|
|||
jQuery.removeData(this, "olddisplay", true);
|
||||
|
||||
start();
|
||||
}
|
||||
};
|
||||
|
||||
// Chaining Tests
|
||||
test("Chain fadeOut fadeIn", function() {
|
||||
|
|
|
@ -2022,6 +2022,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);
|
||||
|
||||
|
|
|
@ -433,7 +433,33 @@ test("offsetParent", function(){
|
|||
equals( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." );
|
||||
});
|
||||
|
||||
function testoffset( name, fn ) {
|
||||
test("fractions (see #7730 and #7885)", function() {
|
||||
expect(2);
|
||||
|
||||
jQuery('body').append('<div id="fractions"/>');
|
||||
|
||||
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() {
|
||||
// pause execution for now
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -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" );
|
||||
|
|
Loading…
Reference in a new issue