Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ChadKillingsworth/jquery
...
head fork: ChadKillingsworth/jquery
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
2  src/effects.js
@@ -361,7 +361,7 @@ jQuery.fn.extend({
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( !( gotoEnd && hadTimers ) ) {
- jQuery.dequeue( this, type );
+ jQuery.dequeue( this, /** @type {string} */ ( type ) );
}
});
}
View
6 src/offset.js
@@ -172,6 +172,7 @@ jQuery.offset = {
jQuery.fn.extend({
+ /** @return {?{left:number,top:number}} */
position: function() {
if ( !this[0] ) {
return null;
@@ -203,6 +204,7 @@ jQuery.fn.extend({
};
},
+ /** @return {!jQuery} */
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
@@ -219,6 +221,10 @@ jQuery.fn.extend({
jQuery.expandedEach( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
+ /**
+ * @param {number=} val
+ * @return {(number|!jQuery)}
+ */
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
View
49 src/queue.js
@@ -48,6 +48,12 @@ jQuery.extend({
}
},
+ /**
+ * @param {Element} elem
+ * @param {string=} type
+ * @param {(Array.<function()>|function(function()))=} data
+ * @return {undefined|string|Array.<function()>|!jQuery}
+ */
queue: function( elem, type, data ) {
var q;
if ( elem ) {
@@ -66,6 +72,10 @@ jQuery.extend({
}
},
+ /**
+ * @param {Element} elem
+ * @param {string=} type
+ */
dequeue: function( elem, type ) {
type = type || "fx";
@@ -99,6 +109,11 @@ jQuery.extend({
});
jQuery.fn.extend({
+ /**
+ * @param {(string|Array.<function()>|function(function()))=} type
+ * @param {(Array.<function()>|function(function()))=} data
+ * @return {(Array.<Element>|!jQuery)}
+ */
queue: function( type, data ) {
var setter = 2;
@@ -109,28 +124,39 @@ jQuery.fn.extend({
}
if ( arguments.length < setter ) {
- return jQuery.queue( this[0], type );
+ return /** @type {!jQuery} */ ( jQuery.queue( this[0], type ) );
}
return data === undefined ?
this :
this.each(function() {
- var queue = jQuery.queue( this, type, data );
+ var queue = jQuery.queue( this, /** @type {string} */ ( type ), data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
+
+ /**
+ * @param {string=} type
+ * @return {!jQuery}
+ */
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
+
+ /**
+ * Based off of the plugin by Clint Helfers, with permission.
+ * @see http://blindsignals.com/index.php/2009/07/jquery-delay/
+ * @param {number} time
+ * @param {string=} type
+ * @return {!jQuery}
+ */
delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ time = jQuery.fx ? jQuery.fx.speeds[ /** @type {string} */ ( time ) ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
@@ -140,11 +166,20 @@ jQuery.fn.extend({
};
});
},
+ /**
+ * @param {string=} type
+ * @return {!jQuery}
+ */
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)
+ /**
+ * Get a promise resolved when queues of a certain type
+ * are emptied (fx is the type by default)
+ * @param {(string|Object)=} type
+ * @param {Object=} object
+ * @return {jQuery.Promise}
+ */
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
View
20 src/traversing.js
@@ -16,6 +16,10 @@ var runtil = /Until$/,
};
jQuery.fn.extend({
+ /**
+ * @param {string|Document|Window|jQuery|Element} selector
+ * @return {!jQuery}
+ */
find: function( selector ) {
var self = this,
i, l;
@@ -53,6 +57,10 @@ jQuery.fn.extend({
return ret;
},
+ /**
+ * @param {string|Element|Document|Window|jQuery|NodeList} target
+ * @return {!jQuery}
+ */
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
@@ -64,14 +72,26 @@ jQuery.fn.extend({
});
},
+ /**
+ * @param {string|Element|Document|Window|Array.<Element>|function(number)|jQuery|NodeList} selector
+ * @return {!jQuery}
+ */
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
+ /**
+ * @param {string|Document|Window|function(number)|Element|jQuery|Array.<Element>|NodeList} selector
+ * @return {!jQuery}
+ */
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
+ /**
+ * @param {string|Document|Window|function(number)|jQuery|Element} selector
+ * @return {boolean}
+ */
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
View
6 test/unit/traversing.js
@@ -37,7 +37,7 @@ test("find(node|jQuery object)", function() {
});
-test("is(String|undefined)", function() {
+test("is(String|undefined)", /** @suppress {checkTypes} */ function() {
expect(30);
ok( jQuery("#form").is("form"), "Check for element: A form must be a form" );
ok( !jQuery("#form").is("div"), "Check for element: A form is not a div" );
@@ -182,7 +182,7 @@ test("index(Object|String|undefined)", function() {
equal( jQuery("#radio2").index("#form :text") , -1, "Check for index not found within a selector" );
});
-test("filter(Selector|undefined)", function() {
+test("filter(Selector|undefined)", /** @suppress {checkTypes} */ function() {
expect(9);
deepEqual( jQuery("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
deepEqual( jQuery("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
@@ -327,7 +327,7 @@ test("closest(jQuery)", function() {
ok( $child.closest( $body.add($parent) ).is("#nothiddendiv"), "Closest ancestor retrieved." );
});
-test("not(Selector|undefined)", function() {
+test("not(Selector|undefined)", /** @suppress {checkTypes} */ function() {
expect(11);
equal( jQuery("#qunit-fixture > p#ap > a").not("#google").length, 2, "not('selector')" );
deepEqual( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );

No commit comments for this range

Something went wrong with that request. Please try again.