* @name attr
* @type Object
* @param String name The name of the property to access.
- * @cat DOM
+ * @cat DOM/Attributes
*/
/**
* @name attr
* @type jQuery
* @param Map properties Key/value pairs to set as object properties.
- * @cat DOM
+ * @cat DOM/Attributes
*/
/**
* @type jQuery
* @param String key The name of the property to set.
* @param Object value The value to set the property to.
- * @cat DOM
+ * @cat DOM/Attributes
*/
attr: function( key, value, type ) {
// Check to see if we're setting style values
*
* @name text
* @type String
- * @cat DOM
+ * @cat DOM/Attributes
*/
/**
* @name text
* @type String
* @param String val The text value to set the contents of the element to.
- * @cat DOM
+ * @cat DOM/Attributes
*/
text: function(e) {
// A surprisingly high number of people expect the
* @example $("p").find("span").end();
* @before <p><span>Hello</span>, how are you?</p>
* @result [ <p>...</p> ]
- * desc Selects all paragraphs, finds span elements inside these, and reverts the
+ * @desc Selects all paragraphs, finds span elements inside these, and reverts the
* selection back to the paragraphs.
*
* @name end
* @param Object prop1 The object that will be merged into the first.
* @param Object propN (optional) More objects to merge into the first
* @type Object
- * @cat Javascript
+ * @cat JavaScript
*/
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
* as $().each() - which is used to iterate, exclusively, over a jQuery
* object. This function can be used to iterate over anything.
*
- * @example $.each( [0,1,2], function(i){
- * alert( "Item #" + i + ": " + this );
+ * The callback has two arguments:the key (objects) or index (arrays) as first
+ * the first, and the value as the second.
+ *
+ * @example $.each( [0,1,2], function(i, n){
+ * alert( "Item #" + i + ": " + n );
* });
- * @desc Iterates over the items in an array, accessing both the current item and its index.
+ * @desc This is an example of iterating over the items in an array,
+ * accessing both the current item and its index.
*
- * @example $.each( { name: "John", lang: "JS" }, function(i){
- * alert( "Name: " + i + ", Value: " + this );
+ * @example $.each( { name: "John", lang: "JS" }, function(i, n){
+ * alert( "Name: " + i + ", Value: " + n );
* });
- * @desc Iterates over the properties in an Object, accessing both the current item and its key.
+ *
+ * @desc This is an example of iterating over the properties in an
+ * Object, accessing both the current item and its key.
*
* @name $.each
* @param Object obj The object, or array, to iterate over.
* @param Function fn The function that will be executed on every object.
* @type Object
- * @cat Javascript
+ * @cat JavaScript
*/
// args is for internal usage only
each: function( obj, fn, args ) {
* @name $.trim
* @type String
* @param String str The string to trim.
- * @cat Javascript
+ * @cat JavaScript
*/
trim: function(t){
return t.replace(/^\s+|\s+$/g, "");
* @type Array
* @param Array first The first array to merge.
* @param Array second The second array to merge.
- * @cat Javascript
+ * @cat JavaScript
*/
merge: function(first, second) {
var r = [].slice.call( first, 0 );
* @param Array array The Array to find items in.
* @param Function fn The function to process each item against.
* @param Boolean inv Invert the selection - select the opposite of the function.
- * @cat Javascript
+ * @cat JavaScript
*/
grep: function(elems, fn, inv) {
// If a string is passed in for the function, make a function
* @type Array
* @param Array array The Array to translate.
* @param Function fn The function to process each item against.
- * @cat Javascript
+ * @cat JavaScript
*/
map: function(elems, fn) {
// If a string is passed in for the function, make a function
}
}
- var r = [ result[0] ];
+ var r = result.length ? [ result[0] ] : [];
check: for ( var i = 1, rl = result.length; i < rl; i++ ) {
for ( var j = 0; j < i; j++ )
* @property
* @name $.browser
* @type Boolean
- * @cat Javascript
+ * @cat JavaScript
*/
/*
* @property
* @name $.boxModel
* @type Boolean
- * @cat Javascript
+ * @cat JavaScript
*/
new function() {
var b = navigator.userAgent.toLowerCase();
* @name removeAttr
* @type jQuery
* @param String name The name of the attribute to remove.
- * @cat DOM
+ * @cat DOM/Attributes
*/
/**
* @name addClass
* @type jQuery
* @param String class A CSS class to add to the elements
- * @cat DOM
+ * @cat DOM/Attributes
* @see removeClass(String)
*/
* @name removeClass
* @type jQuery
* @param String class (optional) A CSS class to remove from the elements
- * @cat DOM
+ * @cat DOM/Attributes
* @see addClass(String)
*/
* @name toggleClass
* @type jQuery
* @param String class A CSS class with which to toggle the elements
- * @cat DOM
+ * @cat DOM/Attributes
*/
/**
jQuery.fn[ n ] = function(num,fn) {
return this.filter( ":" + n + "(" + num + ")", fn );
};
-});
\ No newline at end of file
+});