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

📄 jquery-1.2.6-vsdoc-cn.js

📁 Jquery 1.2.6 最新版本的文档
💻 JS
📖 第 1 页 / 共 5 页
字号:
		///		Part of Core
		///	</summary>
		///	<returns type="jQuery" />
		///	<param name="num" type="Number">
		///		你想要的那个元素的索引值
		///	</param>
	
		return this.slice( i, i + 1 );
	},

	slice: function() {
		///	<summary>
	    ///		选取一个匹配的子集。与原来的slice方法类似。
		///	</summary>
	    ///	<param name="start" type="Number" integer="true">开始选取子集的位置。(从0开始,负数是从集合的尾部开始选起)</param>
	    ///	<param name="end" optional="true" type="Number" integer="true"> (可选) 结束选取自己的位置,
	    ///		如果不指定,则就是本身的结尾。</param>
		///	<returns type="jQuery">被选择的元素</returns>
	
		return this.pushStack(Array.prototype.slice.apply(this, arguments));
	},

	map: function( callback ) {
		///	<summary>
	    ///		将一组元素转换成其他数组(不论是否是元素数组)This member is internal.
	    ///     你可以用这个函数来建立一个列表,不论是值、属性还是CSS样式,或者其他特别形式。
	    ///     这都可以用'$.map()'来方便的建立。
		///	</summary>
		///	<private />
		///	<returns type="jQuery" />
		
		return this.pushStack( jQuery.map(this, function(elem, i){
			return callback.call( elem, i, elem );
		}));
	},

	andSelf: function() {
		///	<summary>
	    ///		加入先前所选的加入当前元素中。
	    ///     对于筛选或查找后的元素,要加入先前所选元素时将会很有用。
		///	</summary>
		///	<returns type="jQuery" />
		
		return this.add( this.prevObject );
	},

	data: function( key, value ){
		///	<summary>
	    ///		在元素上存放数据,同时也返回value。
	    ///     如果jQuery集合指向多个元素,那将在所有元素上设置对应数据。
	    ///     这个函数不用建立一个新的expando,就能在一个元素上存放任何格式的数据,而不仅仅是字符串。
		///	</summary>
	///	<param name="key" type="String">存储的数据名</param>
	///	<param name="value" type="Any">将要存储的任意数据</param>
		///	<returns type="Any">值存储在指定的数据名上</returns>
		
		var parts = key.split(".");
		parts[1] = parts[1] ? "." + parts[1] : "";

		if ( value === undefined ) {
			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);

			if ( data === undefined && this.length )
				data = jQuery.data( this[0], key );

			return data === undefined && parts[1] ?
				this.data( parts[0] ) :
				data;
		} else
			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
				jQuery.data( this, key, value );
			});
	},

	removeData: function( key ){
		///	<summary>
	///		在元素上移除存放的数据
		///	</summary>
		///	<param name="key" type="Element">存储数据中要被删除的元素</param>
		
		return this.each(function(){
			jQuery.removeData( this, key );
		});
	},

		domManip: function( args, table, reverse, callback ) {
		///	<param name="args" type="Array">
		///		 Args
		///	</param>
		///	<param name="table" type="Boolean">
		///		 如果没有就在table元素中插入tbody。
		///	</param>
		///	<param name="dir" type="Number">
		///		 如果dir小于0,则以相反的程序处理参数
		///	</param>
		///	<param name="fn" type="Function">
		///		 执行DOM处理的函数
		///	</param>
		///	<returns type="jQuery" />
		///	<summary>
		///		Part of Core
		///	</summary>
		
		var clone = this.length > 1, elems;

		return this.each(function(){
			if ( !elems ) {
				elems = jQuery.clean( args, this.ownerDocument );

				if ( reverse )
					elems.reverse();
			}

			var obj = this;

			if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
				obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );

			var scripts = jQuery( [] );

			jQuery.each(elems, function(){
				var elem = clone ?
					jQuery( this ).clone( true )[0] :
					this;

				// execute all scripts after the elements have been injected
				if ( jQuery.nodeName( elem, "script" ) )
					scripts = scripts.add( elem );
				else {
					// Remove any inner scripts for later evaluation
					if ( elem.nodeType == 1 )
						scripts = scripts.add( jQuery( "script", elem ).remove() );

					// Inject the elements into the document
					callback.call( obj, elem );
				}
			});

			scripts.each( evalScript );
		});
	}
};

// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;

function evalScript( i, elem ) {
	///	<summary>
	///		这是内部方法。
	///	</summary>
	/// <private />
	
	if ( elem.src )
		jQuery.ajax({
			url: elem.src,
			async: false,
			dataType: "script"
		});

	else
		jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );

	if ( elem.parentNode )
		elem.parentNode.removeChild( elem );
}

function now(){
	///	<summary>
	///		获得当前日期。
	///	</summary>
	///	<returns type="Date">当前日期</returns>
	return +new Date;
}

jQuery.extend = jQuery.fn.extend = function() {
	///	<summary>
    ///		用一个或多个其他对象来扩展一个对象,返回被扩展的对象。
    ///		用于简化继承。
	///		jQuery.extend(settings, options);
	///		var settings = jQuery.extend({}, defaults, options);
	///		Part of JavaScript
	///	</summary>
	///	<param name="target" type="Object">
    ///		 待修改对象。
	///	</param>
	///	<param name="prop1" type="Object">
    ///		 待合并到第一个对象的对象。
	///	</param>
	///	<param name="propN" type="Object" optional="true" parameterArray="true">
    ///		 (可选) 待合并到第一个对象的对象。
	///	</param>
	///	<returns type="Object" />

	// copy reference to target object
	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;

	// Handle a deep copy situation
	if ( target.constructor == Boolean ) {
		deep = target;
		target = arguments[1] || {};
		// skip the boolean and the target
		i = 2;
	}

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target != "object" && typeof target != "function" )
		target = {};

	// extend jQuery itself if only one argument is passed
	if ( length == i ) {
		target = this;
		--i;
	}

	for ( ; i < length; i++ )
		// Only deal with non-null/undefined values
		if ( (options = arguments[ i ]) != null )
			// Extend the base object
			for ( var name in options ) {
				var src = target[ name ], copy = options[ name ];

				// Prevent never-ending loop
				if ( target === copy )
					continue;

				// Recurse if we're merging object values
				if ( deep && copy && typeof copy == "object" && !copy.nodeType )
					target[ name ] = jQuery.extend( deep, 
						// Never move original objects, clone them
						src || ( copy.length != null ? [ ] : { } )
					, copy );

				// Don't bring in undefined values
				else if ( copy !== undefined )
					target[ name ] = copy;

			}

	// Return the modified object
	return target;
};

var expando = "jQuery" + now(), uuid = 0, windowData = {},
	// exclude the following css properties to add px
	exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
	// cache defaultView
	defaultView = document.defaultView || {};

jQuery.extend({
	noConflict: function( deep ) {
		///	<summary>
	    ///		扩展jQuery对象本身。
	    ///		用来在jQuery命名空间上增加新函数。
	    ///     使用这个函数必须以jQuery 开头,不能用$开头
		///		Part of Core 
		///	</summary>
		///	<returns type="undefined" />
		
		window.$ = _$;

		if ( deep )
			window.jQuery = _jQuery;

		return jQuery;
	},

	// See test/unit/core.js for details concerning this function.
	isFunction: function( fn ) {
		///	<summary>
	    ///		确定是否通过参数是一个函数。
		///	</summary>
		///	<param name="fn" type="Object">要检查的对象</param>
		///	<returns type="Boolean">参数是函数就返回true,否则返回false。</returns>
		
		return !!fn && typeof fn != "string" && !fn.nodeName &&
			fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
	},

	// check if an element is in a (or is an) XML document
	isXMLDoc: function( elem ) {
		///	<summary>
	    ///		确定是否通过参数是一个XML文档。
		///	</summary>
		///	<param name="elem" type="Object">要监察的对象</param>
	    ///	<returns type="Boolean">参数是XML文档就返回true,否则返回false。</returns>
	
		return elem.documentElement && !elem.body ||
			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
	},

	// Evalulates a script in a global context
	globalEval: function( data ) {
		///	<summary>
		///		Internally evaluates a script in a global context.
		///	</summary>
		///	<private />

		data = jQuery.trim( data );

		if ( data ) {
			// Inspired by code by Andrea Giammarchi
			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
			var head = document.getElementsByTagName("head")[0] || document.documentElement,
				script = document.createElement("script");

			script.type = "text/javascript";
			if ( jQuery.browser.msie )
				script.text = data;
			else
				script.appendChild( document.createTextNode( data ) );

			// Use insertBefore instead of appendChild  to circumvent an IE6 bug.
			// This arises when a base node is used (#2709).
			head.insertBefore( script, head.firstChild );
			head.removeChild( script );
		}
	},

	nodeName: function( elem, name ) {
		///	<summary>
	    ///		检查指定的元素里是否有指定的DOM节点的名称。
		///	</summary>
		///	<param name="elem" type="Element">要检查的元素</param>
		///	<param name="name" type="String">要确认的节点名称</param>
	    ///	<returns type="Boolean">如果指定的节点名称匹配对应的节点的DOM节点名称返回true; 否则返回 false</returns>

		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
	},

	cache: {},

	data: function( elem, name, data ) {
		///	<summary>
	    ///		在元素上存放数据,同时也返回value。
		///	</summary>
		///	<param name="elem" type="Element">要存放数据的元素</param>
	    ///	<param name="name" type="String">存储的数据名</param>
		///	<param name="data" type="Object">要存储的数据</param>
		///	<returns type="Object">数据参数已经存储</returns>

		elem = elem == window ?
			windowData :
			elem;

		var id = elem[ expando ];

		// Compute a unique ID for the element
		if ( !id )
			id = elem[ expando ] = ++uuid;

		// Only generate the data cache if we're
		// trying to access or manipulate it
		if ( name && !jQuery.cache[ id ] )
			jQuery.cache[ id ] = {};

		// Prevent overriding the named cache with undefined values
		if ( data !== undefined )
			jQuery.cache[ id ][ name ] = data;

		// Return the named cache data, or the ID for the element
		return name ?
			jQuery.cache[ id ][ name ] :
			id;
	},

	removeData: function( elem, name ) {
		///	<summary>
	    ///		在元素上移除存放的数据,与$(...).data(name, value)函数作用相反
		///	</summary>
		///	<param name="elem" type="Element">要删除数据的元素名</param>
		///	<param name="name" type="String">要删除的的数据名</param>

		elem = elem == window ?
			windowData :
			elem;

		var id = elem[ expando ];

		// If we want to remove a specific section of the element's data
		if ( name ) {
			if ( jQuery.cache[ id ] ) {
				// Remove the section of cache data
				delete jQuery.cache[ id ][ name ];

				// If we've removed all the data, remove the element's cache
				name = "";

				for ( name in jQuery.cache[ id ] )
					break;

				if ( !name )
					jQuery.removeData( elem );
			}

		// Otherwise, we want to remove all of the element's data
		} else {
			// Clean up the element expando
			try {
				delete elem[ expando ];
			} catch(e){
				// IE has trouble directly removing the expando

⌨️ 快捷键说明

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