📄 jquery-1.2.6-intellisense.js
字号:
// !context.createElement fails in IE with an error but returns typeof 'object' if (typeof context.createElement == 'undefined') context = context.ownerDocument || context[0] && context[0].ownerDocument || document; jQuery.each(elems, function(i, elem){ if ( !elem ) return; if ( elem.constructor == Number ) elem += ''; // Convert html string into DOM nodes if ( typeof elem == "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + "></" + tag + ">"; }); // Trim whitespace, otherwise indexOf won't work as expected var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); var wrap = // option or optgroup !tags.indexOf("<opt") && [ 1, "<select multiple='multiple'>", "</select>" ] || !tags.indexOf("<leg") && [ 1, "<fieldset>", "</fieldset>" ] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "<table>", "</table>" ] || !tags.indexOf("<tr") && [ 2, "<table><tbody>", "</tbody></table>" ] || // <thead> matched above (!tags.indexOf("<td") || !tags.indexOf("<th")) && [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || !tags.indexOf("<col") && [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || // IE can't serialize <link> and <script> tags normally jQuery.browser.msie && [ 1, "div<div>", "</div>" ] || [ 0, "", "" ]; // Go to html and back, then peel off extra wrappers div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( wrap[0]-- ) div = div.lastChild; // Remove IE's autoinserted <tbody> from table fragments if ( jQuery.browser.msie ) { // String was a <table>, *may* have spurious <tbody> var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? div.childNodes : []; for ( var j = tbody.length - 1; j >= 0 ; --j ) if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) tbody[ j ].parentNode.removeChild( tbody[ j ] ); // IE completely kills leading whitespace when innerHTML is used if ( /^\s/.test( elem ) ) div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); } elem = jQuery.makeArray( div.childNodes ); } if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) ) return; if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options ) ret.push( elem ); else ret = jQuery.merge( ret, elem ); }); return ret; }, attr: function( elem, name, value ) { // don't set attributes on text and comment nodes if (!elem || elem.nodeType == 3 || elem.nodeType == 8) return undefined; var notxml = !jQuery.isXMLDoc( elem ), // Whether we are setting (or getting) set = value !== undefined, msie = jQuery.browser.msie; // Try to normalize/fix the name name = notxml && jQuery.props[ name ] || name; // Only do all the following if this is a node (faster for style) // IE elem.getAttribute passes even for style if ( elem.tagName ) { // These attributes require special treatment var special = /href|src|style/.test( name ); // Safari mis-reports the default selected property of a hidden option // Accessing the parent's selectedIndex property fixes it if ( name == "selected" && jQuery.browser.safari ) elem.parentNode.selectedIndex; // If applicable, access the attribute via the DOM 0 way if ( name in elem && notxml && !special ) { if ( set ){ // We can't allow the type property to be changed (since it causes problems in IE) if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) throw "type property can't be changed"; elem[ name ] = value; } // browsers index elements by id/name on forms, give priority to attributes. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) return elem.getAttributeNode( name ).nodeValue; return elem[ name ]; } if ( msie && notxml && name == "style" ) return jQuery.attr( elem.style, "cssText", value ); if ( set ) // convert the value to a string (all browsers do this but IE) see #1070 elem.setAttribute( name, "" + value ); var attr = msie && notxml && special // Some attributes require a special call on IE ? elem.getAttribute( name, 2 ) : elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return attr === null ? undefined : attr; } // elem is actually elem.style ... set the style // IE uses filters for opacity if ( msie && name == "opacity" ) { if ( set ) { // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level elem.zoom = 1; // Set the alpha filter to set the opacity elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); } return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': ""; } name = name.replace(/-([a-z])/ig, function(all, letter){ return letter.toUpperCase(); }); if ( set ) elem[ name ] = value; return elem[ name ]; }, trim: function( text ) { ///<summary>Remove the whitespace from the beginning and end of a string.</summary> ///<param name="text">The string to trim.</param> ///<returns type="String" /> return (text || "").replace( /^\s+|\s+$/g, "" ); }, makeArray: function( array ) { ///<summary>Turns an array-like object into a true array.</summary> ///<param name="array">Array-like object to turn in to an actual Array.</param> ///<returns type="Array" /> var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval || array.call ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; }, inArray: function( elem, array ) { ///<summary>Determine the index of the first parameter in the Array (-1 if not found).</summary> ///<param name="elem">Value to see if it exists in the array.</param> ///<param name="array">Array to look through for the value.</param> ///<returns type="Number" /> 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 ) { // 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.browser.msie ) { while ( elem = second[ i++ ] ) if ( elem.nodeType != 8 ) first[ pos++ ] = elem; } else while ( elem = second[ i++ ] ) first[ pos++ ] = elem; return first; }, unique: function( array ) { ///<summary>Remove all duplicate elements from an array of elements.</summary> ///<param name="array">The Array to translate.</param> ///<returns type="Array" /> 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.</summary> ///<param name="array">The Array to find items in.</param> ///<param name="callback">The function to process each item against. The first argument to the function is the list item, and the second argument is the list index. The function should return a Boolean value. Optionally, this argument may be a string rather than a function. If the argument is a string, it is treated as a short "lambda-form" function, with "a" representing the list item and "i" representing the index. For example, "a > 0" may be passed instead of "function(a){ return a > 0; }".</param> ///<param name="inv" optional="true">(optional) If "inv" (invert) is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.</param> ///<returns type="Array" /> 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 ) { 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 ); }});var userAgent = navigator.userAgent.toLowerCase();// Figure out what browser is being usedjQuery.browser = { ///<summary>Contains flags for the useragent, read from navigator.userAgent.</summary> version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], safari: /webkit/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )};var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";jQuery.extend({ // Check to see if the W3C box model is being used boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat", props: { "for": "htmlFor", "class": "className", "float": styleFloat, cssFloat: styleFloat, styleFloat: styleFloat, readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing" }});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>Finds a set of elements.</summary> ///<param name="selector" optional="true">(optional) An expression to filter the 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 ) ); };});jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith"}, function(name, original){ jQuery.fn[ name ] = function() { ///<summary> /// 1. appendTo(selctor) - Append all of the matched elements to another, specified, set of elements. /// 2. prependTo(selector) - Prepend all of the matched elements to another, specified, set of elements. /// 3. insertBefore(selector) - Insert all of the matched elements before another, specified, set of elements. /// 4. insertAfter(selector) - Insert all of the matched elements after another, specified, set of elements. /// 5. replaceAll(selector) - Replaces the elements matched by the specified selector with the matched elements. ///</summary> ///<returns type="jQuery" /> var args = arguments; return this.each(function(){ for ( var i = 0, length = args.length; i < length; i++ ) jQuery( args[ i ] )[ original ]( this ); }); };});jQuery.each({ removeAttr: function( name ) { ///<summary>Remove an attribute from each of the matched elements. Note: intellisense not working</summary> ///<param name="name">The name of the property to remove.</param> ///<returns type="jQuery" /> jQuery.attr( this, name, "" );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -