📄 jquery-1.2.6-intellisense.js
字号:
var ret = this.map(function(){ if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the // clone will also remove the events from the orignal // In order to get around this, we use innerHTML. // Unfortunately, this means some modifications to // attributes in IE that are actually only stored // as properties will not be copied (such as the // the name attribute on an input). var clone = this.cloneNode(true), container = document.createElement("div"); container.appendChild(clone); return jQuery.clean([container.innerHTML])[0]; } else return this.cloneNode(true); }); // Need to set the expando to null on the cloned set if it exists // removeData doesn't work here, IE removes it from the original as well // this is primarily for IE but the data expando shouldn't be copied over in any browser var clone = ret.find("*").andSelf().each(function(){ if ( this[ expando ] != undefined ) this[ expando ] = null; }); // Copy the events from the original to the clone if ( events === true ) this.find("*").andSelf().each(function(i){ if (this.nodeType == 3) return; var events = jQuery.data( this, "events" ); for ( var type in events ) for ( var handler in events[ type ] ) jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); }); // Return the cloned set return ret; }, filter: function( selector ) { ///<summary> /// 1. filter(expr) - Removes all elements from the set of matched elements that do not match the specified expression(s). /// 2. filter(fn) - Removes all elements from the set of matched elements that does not match the specified function. ///</summary> ///<param name="selector"> /// 1. expr - An expression to pass into the filter. /// 2. fn - A function to pass into the filter. ///</param> ///<param name="selector"></param> ///<returns type="jQuery" /> return this.pushStack( jQuery.isFunction( selector ) && jQuery.grep(this, function(elem, i){ return selector.call( elem, i ); }) || jQuery.multiFilter( selector, this ) ); }, not: function( selector ) { ///<summary>Removes elements matching the specified expression from the set of matched elements.</summary> ///<param name="selector">An expression with which to remove matching elements, an element to remove from the set or a set of elements to remove from the jQuery set of matched elements.</param> ///<returns type="jQuery" /> if ( selector.constructor == String ) // test special case where just one selector is passed in if ( isSimple.test( selector ) ) return this.pushStack( jQuery.multiFilter( selector, this, true ) ); else selector = jQuery.multiFilter( selector, this ); var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; return this.filter(function() { return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; }); }, add: function( selector ) { ///<summary>Adds more elements, matched by the given expression, to the set of matched elements.</summary> ///<param name="expr">An expression whose matched elements are added for String, a string of HTML to create on the fly for DOMElement or one or more Elements to add if an Array.</param> ///<returns type="jQuery" /> return this.pushStack( jQuery.unique( jQuery.merge( this.get(), typeof selector == 'string' ? jQuery( selector ) : jQuery.makeArray( selector ) ))); }, is: function( selector ) { ///<summary>Checks the current selection against an expression and returns true, if at least one element of the selection fits the given expression.</summary> ///<param name="selector">The expression with which to filter</param> ///<returns type="Boolean" /> return !!selector && jQuery.multiFilter( selector, this ).length > 0; }, hasClass: function( selector ) { ///<summary>Checks the current selection against a class and returns true, if at least one element of the selection has the given class.</summary> ///<param name="selector">The class to match.</param> ///<returns type="Boolean" /> return this.is( "." + selector ); }, val: function( value ) { ///<summary> /// 1. val() - Get the content of the value attribute of the first matched element. Returns String or Array /// 2. val(value) - Set the value attribute of every matched element. /// 3. val(value) - Checks, or selects, all the radio buttons, checkboxes, and select options that match the set of values. ///</summary> ///<param name="value" optional="true">(optional) The value to set on the matched element.</param> ///<returns type="jQuery" /> if ( value == undefined ) { if ( this.length ) { var elem = this[0]; // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type == "select-one"; // Nothing was selected if ( index < 0 ) return null; // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; if ( option.selected ) { // Get the specifc value for the option value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; // We don't need an array for one selects if ( one ) return value; // Multi-Selects return an array values.push( value ); } } return values; // Everything else, we just grab the value } else return (this[0].value || "").replace(/\r/g, ""); } return undefined; } if( value.constructor == Number ) value += ''; return this.each(function(){ if ( this.nodeType != 1 ) return; if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) this.checked = (jQuery.inArray(this.value, value) >= 0 || jQuery.inArray(this.name, value) >= 0); else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(value); jQuery( "option", this ).each(function(){ this.selected = (jQuery.inArray( this.value, values ) >= 0 || jQuery.inArray( this.text, values ) >= 0); }); if ( !values.length ) this.selectedIndex = -1; } else this.value = value; }); }, html: function( value ) { ///<summary> /// 1. html() - Get the html contents (innerHTML) of the first matched element. This property is not available on XML documents (although it will work for XHTML documents). Returns String. /// 2. html(val) - Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents).</summary> ///<param name="" optional="true">(optional) Set the html contents to the specified value.</param> ///<returns type="jQuery" /> return value == undefined ? (this[0] ? this[0].innerHTML : null) : this.empty().append( value ); }, replaceWith: function( value ) { ///<summary>Replaces all matched elements with the specified HTML or DOM elements.</summary> ///<param name="value">Content to replace the matched elements with</param> ///<returns type="jQuery" /> return this.after( value ).remove(); }, eq: function( i ) { ///<summary>Reduce the set of matched elements to a single element.</summary> ///<param name="i">The index of the element to select.</param> ///<returns type="jQuery" /> return this.slice( i, i + 1 ); }, slice: function() { ///<summary> /// slice(start, [end]) - Selects a subset of the matched elements. /// start - Where to start the subset. The first element is at zero. Can be negative to start from the end of the selection. /// end - (optional) Where to end the subset. If unspecified, ends at the end of the selection. ///</summary> ///<returns type="jQuery" /> return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); }, map: function( callback ) { ///<summary>Translate a set of elements in the jQuery object into another set of values in an array (which may, or may not, be elements).</summary> ///<param name="callback">The function to execute on each element in the set.</param> ///<returns type="jQuery" /> return this.pushStack( jQuery.map(this, function(elem, i){ return callback.call( elem, i, elem ); })); }, andSelf: function() { ///<summary>Add the previous selection to the current selection.</summary> ///<returns type="jQuery" /> return this.add( this.prevObject ); }, data: function( key, value ){ ///<summary> /// 1. data(key) - Returns value at named data store for the element, as set by data(name, value). /// 2. data(key, value) - Stores the value in the named spot and also returns the value. ///</summary> ///<param name="key" type="String">Name of the data stored, or to be stored.</param> ///<param name="value" type="String">(optional) Value to be stored.</param> ///<returns type="jQuery" /> 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> /// 1. removeData(key) - Remove the expando attribute that allows data storage on an element.</summary> /// 2. removeData(key, [optional] value) - Removes just this one named data store. ///<param name="key" type="Element"> /// 1. removeData(key) - Element to delete the data store from. /// 2. removeData(key, value) - The name of the data store property to remove. ///</param> ///<returns type="jQuery" /> return this.each(function(){ jQuery.removeData( this, key ); }); }, domManip: function( args, table, reverse, callback ) { ///<summary>Interal method called by insertBefore(), append(), and others to manipulate the DOM.</summary> ///<param name="args" type="String"></param> ///<param name="table" type="String"></param> ///<param name="reverse" type="String"></param> ///<param name="callback" type="String"></param> ///<returns type="jQuery" /> 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 instantiationjQuery.fn.init.prototype = jQuery.fn;function evalScript( i, elem ) { 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(){ return +new Date;}jQuery.extend = jQuery.fn.extend = function() { ///<summary> ///extend(target, object1, [objectN]) - Extends the jQuery element set to provide new methods (used to make a typical jQuery plugin). /// target - The object to extend. /// object1 - The object that will be merged into the first. /// objectN - (optional) More objects to merge into the first. ///</summary> ///<param name="object">The object that will be merged into the jQuery object. note: intellisense not working.</param> ///<returns type="jQuery" /> // 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; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -