⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jquery-1.3.2-vsdoc.js

📁 javascript的增强版,使javascript变的更容易.
💻 JS
📖 第 1 页 / 共 5 页
字号:
			elem[ name ] = value;

		return elem[ name ];
	},

	trim: function( text ) {
		///	<summary>
		///		Remove the whitespace from the beginning and end of a string.
		///		Part of JavaScript
		///	</summary>
		///	<returns type="String" />
		///	<param name="text" type="String">
		///		The string to trim.
		///	</param>

		return (text || "").replace( /^\s+|\s+$/g, "" );
	},

	makeArray: function( array ) {
		///	<summary>
		///		Turns anything into a true array.  This is an internal method.
		///	</summary>
		///	<param name="array" type="Object">Anything to turn into an actual Array</param>
		///	<returns type="Array" />
		///	<private />

		var ret = [];

		if( array != null ){
			var i = array.length;
			// The window, strings (and functions) also have 'length'
			if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
				ret[0] = array;
			else
				while( i )
					ret[--i] = array[i];
		}

		return ret;
	},

	inArray: function( elem, array ) {
		///	<summary>
		///		Determines the index of the first parameter in the array.
		///	</summary>
		///	<param name="elem">The value to see if it exists in the array.</param>
		///	<param name="array" type="Array">The array to look through for the value</param>
		///	<returns type="Number" integer="true">The 0-based index of the item if it was found, otherwise -1.</returns>

		for ( var i = 0, length = array.length; i < length; i++ )
		// Use === because on IE, window == document
			if ( array[ i ] === elem )
				return i;

		return -1;
	},

	merge: function( first, second ) {
		///	<summary>
		///		Merge two arrays together, removing all duplicates.
		///		The new array is: All the results from the first array, followed
		///		by the unique results from the second array.
		///		Part of JavaScript
		///	</summary>
		///	<returns type="Array" />
		///	<param name="first" type="Array">
		///		 The first array to merge.
		///	</param>
		///	<param name="second" type="Array">
		///		 The second array to merge.
		///	</param>

		// We have to loop this way because IE & Opera overwrite the length
		// expando of getElementsByTagName
		var i = 0, elem, pos = first.length;
		// Also, we need to make sure that the correct elements are being returned
		// (IE returns comment nodes in a '*' query)
		if ( !jQuery.support.getAll ) {
			while ( (elem = second[ i++ ]) != null )
				if ( elem.nodeType != 8 )
					first[ pos++ ] = elem;

		} else
			while ( (elem = second[ i++ ]) != null )
				first[ pos++ ] = elem;

		return first;
	},

	unique: function( array ) {
		///	<summary>
		///		Removes all duplicate elements from an array of elements.
		///	</summary>
		///	<param name="array" type="Array&lt;Element&gt;">The array to translate</param>
		///	<returns type="Array&lt;Element&gt;">The array after translation.</returns>

		var ret = [], done = {};

		try {

			for ( var i = 0, length = array.length; i < length; i++ ) {
				var id = jQuery.data( array[ i ] );

				if ( !done[ id ] ) {
					done[ id ] = true;
					ret.push( array[ i ] );
				}
			}

		} catch( e ) {
			ret = array;
		}

		return ret;
	},

	grep: function( elems, callback, inv ) {
		///	<summary>
		///		Filter items out of an array, by using a filter function.
		///		The specified function will be passed two arguments: The
		///		current array item and the index of the item in the array. The
		///		function must return 'true' to keep the item in the array, 
		///		false to remove it.
		///		});
		///		Part of JavaScript
		///	</summary>
		///	<returns type="Array" />
		///	<param name="elems" type="Array">
		///		array The Array to find items in.
		///	</param>
		///	<param name="fn" type="Function">
		///		 The function to process each item against.
		///	</param>
		///	<param name="inv" type="Boolean">
		///		 Invert the selection - select the opposite of the function.
		///	</param>
		
		var ret = [];

		// Go through the array, only saving the items
		// that pass the validator function
		for ( var i = 0, length = elems.length; i < length; i++ )
			if ( !inv != !callback( elems[ i ], i ) )
				ret.push( elems[ i ] );

		return ret;
	},

	map: function( elems, callback ) {
		///	<summary>
		///		Translate all items in an array to another array of items.
		///		The translation function that is provided to this method is 
		///		called for each item in the array and is passed one argument: 
		///		The item to be translated.
		///		The function can then return the translated value, 'null'
		///		(to remove the item), or  an array of values - which will
		///		be flattened into the full array.
		///		Part of JavaScript
		///	</summary>
		///	<returns type="Array" />
		///	<param name="elems" type="Array">
		///		array The Array to translate.
		///	</param>
		///	<param name="fn" type="Function">
		///		 The function to process each item against.
		///	</param>
		
		var ret = [];

		// Go through the array, translating each of the items to their
		// new value (or values).
		for ( var i = 0, length = elems.length; i < length; i++ ) {
			var value = callback( elems[ i ], i );

			if ( value != null )
				ret[ ret.length ] = value;
		}

		return ret.concat.apply( [], ret );
	}
});

// Use of jQuery.browser is deprecated.
// It's included for backwards compatibility and plugins,
// although they should work to migrate away.

var userAgent = navigator.userAgent.toLowerCase();

// Figure out what browser is being used
jQuery.browser = {
	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
	safari: /webkit/.test( userAgent ),
	opera: /opera/.test( userAgent ),
	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};

// [vsdoc] The following section has been denormalized from original sources for IntelliSense.
// jQuery.each({
// 	parent: function(elem){return elem.parentNode;},
// 	parents: function(elem){return jQuery.dir(elem,"parentNode");},
// 	next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
// 	prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
// 	nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
// 	prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
// 	siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
// 	children: function(elem){return jQuery.sibling(elem.firstChild);},
// 	contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
// }, function(name, fn){
// 	jQuery.fn[ name ] = function( selector ) {
// 		///	<summary>
// 		///		Get a set of elements containing the unique parents of the matched
// 		///		set of elements.
// 		///		Can be filtered with an optional expressions.
// 		///		Part of DOM/Traversing
// 		///	</summary>
// 		///	<param name="expr" type="String" optional="true">
// 		///		(optional) An expression to filter the parents with
// 		///	</param>
// 		///	<returns type="jQuery" />   
// 		
// 		var ret = jQuery.map( this, fn );
// 
// 		if ( selector && typeof selector == "string" )
// 			ret = jQuery.multiFilter( selector, ret );
// 
// 		return this.pushStack( jQuery.unique( ret ), name, selector );
// 	};
// });

jQuery.each({
	parent: function(elem){return elem.parentNode;}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		///	<summary>
		///		Get a set of elements containing the unique parents of the matched
		///		set of elements.
		///		Can be filtered with an optional expressions.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the parents with
		///	</param>
		///	<returns type="jQuery" />   
		
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	parents: function(elem){return jQuery.dir(elem,"parentNode");}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		///	<summary>
		///		Get a set of elements containing the unique ancestors of the matched
		///		set of elements (except for the root element).
		///		Can be filtered with an optional expressions.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the ancestors with
		///	</param>
		///	<returns type="jQuery" />   
		
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	next: function(elem){return jQuery.nth(elem,2,"nextSibling");}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		///	<summary>
		///		Get a set of elements containing the unique next siblings of each of the
		///		matched set of elements.
		///		It only returns the very next sibling, not all next siblings.
		///		Can be filtered with an optional expressions.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the next Elements with
		///	</param>
		///	<returns type="jQuery" />
		
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		///	<summary>
		///		Get a set of elements containing the unique previous siblings of each of the
		///		matched set of elements.
		///		Can be filtered with an optional expressions.
		///		It only returns the immediately previous sibling, not all previous siblings.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the previous Elements with
		///	</param>
		///	<returns type="jQuery" />
		
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}
}, function(name, fn){
	jQuery.fn[name] = function(selector) {
		///	<summary>
		///		Finds all sibling elements after the current element.
		///		Can be filtered with an optional expressions.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the next Elements with
		///	</param>
		///	<returns type="jQuery" />
		
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		///	<summary>
		///		Finds all sibling elements before the current element.
		///		Can be filtered with an optional expressions.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the previous Elements with
		///	</param>
		///	<returns type="jQuery" />
	
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}
}, function(name, fn){
	jQuery.fn[ name ] = function( selector ) {
		///	<summary>
		///		Get a set of elements containing all of the unique siblings of each of the
		///		matched set of elements.
		///		Can be filtered with an optional expressions.
		///		Part of DOM/Traversing
		///	</summary>
		///	<param name="expr" type="String" optional="true">
		///		(optional) An expression to filter the sibling Elements with
		///	</param>
		///	<returns type="jQuery" />
		
		var ret = jQuery.map( this, fn );

		if ( selector && typeof selector == "string" )
			ret = jQuery.multiFilter( selector, ret );

		return this.pushStack( jQuery.unique( ret ), name, selector );
	};
});

jQuery.each({
	children: function(elem){return jQuery.sibling(elem.firstChild);}
}, function(n

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -