📄 jquery.1.2.3.intellisense.js
字号:
(function(){/* * jQuery 1.2.3 - New Wave Javascript * * Copyright (c) 2008 John Resig (jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $ * $Rev: 4663 $ */// Map over jQuery in case of overwriteif ( window.jQuery ) var _jQuery = window.jQuery;var jQuery = window.jQuery = function( selector, context ) { ///<summary> /// This function accepts a string containing a CSS selector which is then used to match a set of elements. ///</summary> ///<param name="selector"> /// 1. An expression to search with. /// 2. html - Create DOM elements on-the-fly from the provided String of raw HTML. /// 3. elements - Wrap jQuery functionality around a single or multiple DOM Element(s). /// 4. callback - A shorthand for $(document).ready(). ///</param> ///<param name="context" optional="true">(optional) A DOM Element, Document or jQuery to use as context</param> ///<returns type="jQuery" /> // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.prototype.init( selector, context );};// Map over the $ in case of overwriteif ( window.$ ) var _$ = window.$; // Map the jQuery namespace to the '$' onewindow.$ = jQuery;// A simple way to check for HTML strings or ID strings// (both of which we optimize for)var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;// Is it a simple selectorvar isSimple = /^.[^:#\[\.]*$/;jQuery.fn = jQuery.prototype = { init: function( selector, context ) { // Make sure that a selection was provided selector = selector || document; // Handle $(DOMElement) if ( selector.nodeType ) { this[0] = selector; this.length = 1; return this; // Handle HTML strings } else if ( typeof selector == "string" ) { // Are we dealing with HTML string or an ID? var match = quickExpr.exec( selector ); // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) selector = jQuery.clean( [ match[1] ], context ); // HANDLE: $("#id") else { var elem = document.getElementById( match[3] ); // Make sure an element was located if ( elem ) // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id != match[3] ) return jQuery().find( selector ); // Otherwise, we inject the element directly into the jQuery object else { this[0] = elem; this.length = 1; return this; } else selector = []; } // HANDLE: $(expr, [context]) // (which is just equivalent to: $(content).find(expr) } else return new jQuery( context ).find( selector ); // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); return this.setArray( // HANDLE: $(array) selector.constructor == Array && selector || // HANDLE: $(arraylike) // Watch for when an array-like object, contains DOM nodes, is passed in as the selector (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) || // HANDLE: $(*) [ selector ] ); }, // The current version of jQuery being used jquery: "1.2.3", // The number of elements contained in the matched element set size: function() { ///<summary>The number of elements in the jQuery object.</summary> ///<returns type="Number" /> return this.length; }, // The number of elements contained in the matched element set length: 0, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { ///<summary>note: lookup this function</summary> ///<returns type="jQuery" /> return num == undefined ? ///<summary>Access all matched DOM elements. note: intellisense not working.</summary> ///<param name="num" type="Number" optional="true">(optional) Access the element in the Nth position.</param> ///<returns type="Array" /> // Return a 'clean' array jQuery.makeArray( this ) : // Return just the object this[ num ]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery( elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; // Return the newly-formed element set return ret; }, // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack setArray: function( elems ) { // Resetting the length to 0, then using the native Array push // is a super-fast way to populate an object with array-like properties this.length = 0; Array.prototype.push.apply( this, elems ); return this; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { ///<summary>Execute a function within the context of every matched element.</summary> ///<param name="callback">The callback to execute for each matched element.</param> ///<param name="args">(You can seed the arguments with an array of args, but this is only used internally.)</param> ///<returns type="jQuery" /> return jQuery.each( this, callback, args ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { ///<summary>Searches every matched element for the object and returns the index of the element, if found, starting with zero.</summary> ///<param name="elem">Object to search for.</param> ///<returns type="Number" /> var ret = -1; // Locate the position of the desired element this.each(function(i){ if ( this == elem ) ret = i; }); return ret; }, attr: function( name, value, type ) { ///<summary> /// 1. attr(name) - Access a property on the first matched element. This method makes it easy to retrieve a property value from the first matched element. If the element does not have an attribute with such a name, undefined is returned. Returns Object. /// 2. attr(properties) - Set a key/value object as properties to all matched elements. /// 3. attr(key, value) - Set a single property to a value, on all matched elements. /// 4. attr(key, fn) - Set a single property to a computed value, on all matched elements. ///</summary> ///<param name="name" optional="true">(optional) The name of the property to access.</param> ///<param name="value" optional="true">(optional) The value to set the property to.</param> ///<param name="type" optional="true">(optional) This method only accepts 2 parameters, see the summary.</param> ///<returns type="jQuery" /> var options = name; // Look for the case where we're accessing a style value if ( name.constructor == String ) if ( value == undefined ) return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined; else { options = {}; options[ name ] = value; } // Check to see if we're setting style values return this.each(function(i){ // Set all the styles for ( name in options ) jQuery.attr( type ? this.style : this, name, jQuery.prop( this, options[ name ], type, i, name ) ); }); }, css: function( key, value ) { ///<summary> /// 1. css(key) - Return a style property on the first matched element. /// 2. css(value) - Set a key/value object as style properties to all matched elements. /// 3. css(key, value) - Set a single style property to a value on all matched elements. ///</summary> ///<param name="key" optional="true">(optional) The name of the property to access.</param> ///<param name="value" optional="true">(optional) Key/value pairs to set as style properties.</param> ///<returns type="jQuery" /> // ignore negative width and height values if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) value = undefined; return this.attr( key, value, "curCSS" ); }, text: function( text ) { ///<summary> /// 1. text() - Get the combined text contents of all matched elements. Returns String. /// 2. text(text) - Set the text contents of all matched elements. ///</summary> ///<param name="text" optional="true">(optional) The text value to set the contents of the element to.</param> ///<returns type="jQuery" /> if ( typeof text != "object" && text != null ) return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); var ret = ""; jQuery.each( text || this, function(){ jQuery.each( this.childNodes, function(){ if ( this.nodeType != 8 ) ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text( [ this ] ); }); }); return ret; }, wrapAll: function( html ) { ///<summary>wrap(html) or wrap(elem) - Wrap all the elements in the matched set into a single wrapper element.</summary> ///<param name="html">A string of HTML that will be created on the fly and wrapped around the target, or a DOM element that will be wrapped around the target.</param> ///<returns type="jQuery" /> if ( this[0] ) // The elements to wrap the target around jQuery( html, this[0].ownerDocument ) .clone() .insertBefore( this[0] ) .map(function(){ var elem = this; while ( elem.firstChild ) elem = elem.firstChild; return elem; }) .append(this); return this; }, wrapInner: function( html ) { ///<summary>wrapInner(html) or wrapInner(elem) - Wrap the inner child contents of each matched element (including text nodes) with an HTML structure.</summary> ///<param name="html">A string of HTML that will be created on the fly and wrapped around the target, or a DOM element that will be wrapped around the target.</param> ///<returns type="jQuery" /> return this.each(function(){ jQuery( this ).contents().wrapAll( html ); }); }, wrap: function( html ) { ///<summary> ///wrap(html) or wrap(elem) - Wrap all matched elements with a structure of other elements. ///</summary> ///<param name="html">A string of HTML that will be created on the fly and wrapped around the target, or a DOM element that will be wrapped around the target.</param> ///<returns type="jQuery" /> return this.each(function(){ jQuery( this ).wrapAll( html ); }); }, append: function() { ///<summary>append(content) - Append content to the inside of every matched element. content - Content to append to the target.</summary> ///<returns type="jQuery" /> return this.domManip(arguments, true, false, function(elem){ if (this.nodeType == 1) this.appendChild( elem ); }); }, prepend: function() { ///<summary>prepend(content) - Prepend content to the inside of every matched element. content - Content to prepend to the target.</summary> ///<param name="content">Content to prepend to the target.</param> ///<returns type="jQuery" /> return this.domManip(arguments, true, true, function(elem){ if (this.nodeType == 1) this.insertBefore( elem, this.firstChild ); }); }, before: function() { ///<summary>before(content) - Insert content before each of the matched elements. content - Content to insert before each target.</summary> ///<returns type="jQuery" /> return this.domManip(arguments, false, false, function(elem){ this.parentNode.insertBefore( elem, this ); }); }, after: function() { ///<summary> ///after(content) - Insert content after each of the matched elements. content - Content to insert after each target. ///</summary> ///<returns type="jQuery" /> return this.domManip(arguments, false, true, function(elem){ this.parentNode.insertBefore( elem, this.nextSibling ); }); }, end: function() { ///<summary>Revert the most recent 'destructive' operation, changing the set of matched elements to its previous state (right before the destructive operation).</summary> ///<returns type="jQuery" /> return this.prevObject || jQuery( [] ); }, find: function( selector ) { var elems = jQuery.map(this, function(elem){ return jQuery.find( selector, elem ); }); return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? jQuery.unique( elems ) : elems ); }, clone: function( events ) { ///<summary>Clone matched DOM Elements and select the clones.</summary> ///<param name="events" optional="true">(optional) Set to true to enable cloning of event handlers.</param> ///<returns type="jQuery" /> // Do the clone 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); });
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -