*/
function jQuery(a,c) {
+ // Initalize the extra macro functions
+ if ( !jQuery.initDone ) jQuery.init();
+
// Shortcut for document ready (because $(document).each() is silly)
if ( a && a.constructor == Function && jQuery.fn.ready )
return jQuery(document).ready(a);
* Handle support for overriding other $() functions. Way too many libraries
* provide this function to simply ignore it and overwrite it.
*/
-
+ /*
// Check to see if this is a possible collision case
if ( jQuery._$ && !c && a.constructor == String &&
// Use the default method, in case it works some voodoo
return jQuery._$( a );
+ */
// Watch for when a jQuery object is passed as the selector
if ( a.jquery )
if ( window == this )
return new jQuery(a,c);
+ // Handle HTML strings
+ var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
+ if ( m ) a = jQuery.clean( [ m[1] ] );
+
// Watch for when an array is passed in
- this.get( a.constructor == Array ?
- // Assume that it's an array of DOM Elements
- a :
+ this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ?
+ // Assume that it is an array of DOM Elements
+ jQuery.merge( a, [] ) :
// Find the matching elements and save them for later
jQuery.find( a, c ) );
* @property
* @name jquery
* @type String
+ * @cat Core
*/
jquery: "$Rev$",
* @property
* @name length
* @type Number
+ * @cat Core
*/
/**
*
* @name size
* @type Number
+ * @cat Core
*/
size: function() {
return this.length;
*
* @name get
* @type Array<Element>
+ * @cat Core
*/
/**
- * Access a single matched element. <tt>num</tt> is used to access the
- * <tt>num</tt>th element matched.
+ * Access a single matched element. num is used to access the
+ * Nth element matched.
*
* @example $("img").get(1);
* @before <img src="test1.jpg"/> <img src="test2.jpg"/>
*
* @name get
* @type Element
- * @param Number num Access the element in the <tt>num</tt>th position.
+ * @param Number num Access the element in the Nth position.
+ * @cat Core
*/
/**
* @name get
* @type jQuery
* @param Elements elems An array of elements
+ * @cat Core
*/
get: function( num ) {
// Watch for when an array (of elements) is passed in
// Return just the object
this[num];
},
-
+
/**
* Execute a function within the context of every matched element.
* This means that every time the passed-in function is executed
* @name each
* @type jQuery
* @param Function fn A function to execute
+ * @cat Core
*/
each: function( fn, args ) {
- // Iterate through all of the matched elements
- for ( var i = 0; i < this.length; i++ )
-
- // Execute the function within the context of each element
- fn.apply( this[i], args || [i] );
-
- return this;
+ return jQuery.each( this, fn, args );
},
/**
* @name attr
* @type Object
* @param String name The name of the property to access.
+ * @cat DOM
*/
/**
* @name attr
* @type jQuery
* @param Hash prop A set of key/value pairs to set as object properties.
+ * @cat DOM
*/
/**
* @type jQuery
* @param String key The name of the property to set.
* @param Object value The value to set the property to.
+ * @cat DOM
*/
attr: function( key, value, type ) {
// Check to see if we're setting style values
- return key.constructor != String || value ?
+ return key.constructor != String || value != undefined ?
this.each(function(){
// See if we're setting a hash of styles
if ( value == undefined )
* @name css
* @type Object
* @param String name The name of the property to access.
+ * @cat CSS
*/
/**
* @name css
* @type jQuery
* @param Hash prop A set of key/value pairs to set as style properties.
+ * @cat CSS
*/
/**
* @type jQuery
* @param String key The name of the property to set.
* @param Object value The value to set the property to.
+ * @cat CSS
*/
css: function( key, value ) {
- return this.attr( key, value, "css" );
+ return this.attr( key, value, "curCSS" );
},
/**
*
* @name text
* @type String
+ * @cat DOM
*/
text: function(e) {
e = e || this;
* @any Element elem A DOM element that will be wrapped.
* @any Array<Element> elems An array of elements, the first of which will be wrapped.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
wrap: function() {
// The elements to wrap the target around
/**
* Append any number of elements to the inside of all matched elements.
- * This operation is similar to doing an <tt>appendChild</tt> to all the
+ * This operation is similar to doing an appendChild to all the
* specified elements, adding them into the document.
*
* @example $("p").append("<b>Hello</b>");
* @any Element elem A DOM element that will be appended.
* @any Array<Element> elems An array of elements, all of which will be appended.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
append: function() {
return this.domManip(arguments, true, 1, function(a){
* @any Element elem A DOM element that will be prepended.
* @any Array<Element> elems An array of elements, all of which will be prepended.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
prepend: function() {
return this.domManip(arguments, true, -1, function(a){
* @any Element elem A DOM element that will beinserted.
* @any Array<Element> elems An array of elements, all of which will be inserted.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
before: function() {
return this.domManip(arguments, false, 1, function(a){
* @any Element elem A DOM element that will beinserted.
* @any Array<Element> elems An array of elements, all of which will be inserted.
* @any Object obj Any object, converted to a string, then a text node.
+ * @cat DOM/Manipulation
*/
after: function() {
return this.domManip(arguments, false, -1, function(a){
*
* @name end
* @type jQuery
+ * @cat DOM/Traversing
*/
end: function() {
return this.get( this.stack.pop() );
* @name find
* @type jQuery
* @param String expr An expression to search with.
+ * @cat DOM/Traversing
*/
find: function(t) {
return this.pushStack( jQuery.map( this, function(a){
* @name filter
* @type jQuery
* @param String expr An expression to search with.
+ * @cat DOM/Traversing
*/
- /**
- * Removes all elements from the set of matched elements that do not
- * match at least one of the expressions passed to the function. This
- * method is used when you want to filter the set of matched elements
- * through more than one expression.
- *
- * Elements will be retained in the jQuery object if they match at
- * least one of the expressions passed.
- *
- * @example $("p").filter([".selected", ":first"])
- * @before <p>Hello</p><p>Hello Again</p><p class="selected">And Again</p>
- * @result $("p").filter([".selected", ":first"]) == [ <p>Hello</p>, <p class="selected">And Again</p> ]
- *
- * @name filter
- * @type jQuery
- * @param Array<String> exprs A set of expressions to evaluate against
- */
+ /**
+ * Removes all elements from the set of matched elements that do not
+ * match at least one of the expressions passed to the function. This
+ * method is used when you want to filter the set of matched elements
+ * through more than one expression.
+ *
+ * Elements will be retained in the jQuery object if they match at
+ * least one of the expressions passed.
+ *
+ * @example $("p").filter([".selected", ":first"])
+ * @before <p>Hello</p><p>Hello Again</p><p class="selected">And Again</p>
+ * @result $("p").filter([".selected", ":first"]) == [ <p>Hello</p>, <p class="selected">And Again</p> ]
+ *
+ * @name filter
+ * @type jQuery
+ * @param Array<String> exprs A set of expressions to evaluate against
+ * @cat DOM/Traversing
+ */
filter: function(t) {
- return t.constructor == Array ?
- // Multi Filtering
- this.pushStack( jQuery.map(this,function(a){
+ return this.pushStack(
+ t.constructor == Array &&
+ jQuery.map(this,function(a){
for ( var i = 0; i < t.length; i++ )
if ( jQuery.filter(t[i],[a]).r.length )
return a;
- }), arguments ) :
-
- this.pushStack( jQuery.filter(t,this).r, arguments );
+ }) ||
+
+ t.constructor == Boolean &&
+ ( t ? this.get() : [] ) ||
+
+ t.constructor == Function &&
+ jQuery.grep( this, t ) ||
+
+ jQuery.filter(t,this).r, arguments );
},
/**
* @name not
* @type jQuery
* @param Element el An element to remove from the set
+ * @cat DOM/Traversing
*/
/**
* @name not
* @type jQuery
* @param String expr An expression with which to remove matching elements
+ * @cat DOM/Traversing
*/
not: function(t) {
return this.pushStack( t.constructor == String ?
* @name add
* @type jQuery
* @param String expr An expression whose matched elements are added
+ * @cat DOM/Traversing
*/
/**
* @name add
* @type jQuery
* @param Array<Element> els An array of Elements to add
+ * @cat jQuery
*/
- /**
- * Adds a single Element to the set of matched elements. This is used to
- * add a single Element to a jQuery object.
- *
- * @example $("p").add( document.getElementById("a") )
- * @before <p>Hello</p><p><span id="a">Hello Again</span></p>
- * @result [ <p>Hello</p>, <span id="a">Hello Again</span> ]
- *
- * @name add
- * @type jQuery
- * @param Element el An Element to add
- */
+ /**
+ * Adds a single Element to the set of matched elements. This is used to
+ * add a single Element to a jQuery object.
+ *
+ * @example $("p").add( document.getElementById("a") )
+ * @before <p>Hello</p><p><span id="a">Hello Again</span></p>
+ * @result [ <p>Hello</p>, <span id="a">Hello Again</span> ]
+ *
+ * @name add
+ * @type jQuery
+ * @param Element el An Element to add
+ * @cat jQuery
+ */
add: function(t) {
return this.pushStack( jQuery.merge( this, t.constructor == String ?
jQuery.find(t) : t.constructor == Array ? t : [t] ), arguments );
* @member jQuery
* @param {String} expr The expression with which to filter
* @type Boolean
+ * @cat jQuery
*/
is: function(expr) {
- return jQuery.filter(expr,this).r.length > 0;
+ return expr ? jQuery.filter(expr,this).r.length > 0 : this.length > 0;
},
/**
} else
obj = tbody[0];
}
-
+
for ( var i = ( dir < 0 ? a.length - 1 : 0 );
- i != ( dir < 0 ? dir : a.length ); i += dir )
- fn.apply( obj, [ a[i] ] );
+ i != ( dir < 0 ? dir : a.length ); i += dir ) {
+ fn.apply( obj, [ clone ? a[i].cloneNode(true) : a[i] ] );
+ }
});
},
}
return this;
- },
-
- extend: function(obj,prop) {
- if ( !prop ) { prop = obj; obj = this; }
- for ( var i in prop ) obj[i] = prop[i];
- return obj;
}
};
-jQuery.extend = jQuery.fn.extend;
-
-new function() {
- var b = navigator.userAgent.toLowerCase();
-
- // Figure out what browser is being used
- jQuery.browser = {
- safari: /webkit/.test(b),
- opera: /opera/.test(b),
- msie: /msie/.test(b) && !/opera/.test(b),
- mozilla: /mozilla/.test(b) && !/compatible/.test(b)
- };
-
- // Check to see if the W3C box model is being used
- jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
-
- var axis = {
- /**
- * Get a set of elements containing the unique parents of the matched
- * set of elements.
- *
- * @example $("p").parent()
- * @before <div><p>Hello</p><p>Hello</p></div>
- * @result [ <div><p>Hello</p><p>Hello</p></div> ]
- *
- * @name parent
- * @type jQuery
- */
-
- /**
- * Get a set of elements containing the unique parents of the matched
- * set of elements, and filtered by an expression.
- *
- * @example $("p").parent(".selected")
- * @before <div><p>Hello</p></div><div class="selected"><p>Hello Again</p></div>
- * @result [ <div class="selected"><p>Hello Again</p></div> ]
- *
- * @name parent
- * @type jQuery
- * @param String expr An expression to filter the parents with
- */
- parent: "a.parentNode",
-
- /**
- * Get a set of elements containing the unique ancestors of the matched
- * set of elements.
- *
- * @example $("span").ancestors()
- * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
- * @result [ <body>...</body>, <div>...</div>, <p><span>Hello</span></p> ]
- *
- * @name ancestors
- * @type jQuery
- */
+/**
+ *
+ *
+ * @private
+ * @name extend
+ * @param Object obj
+ * @param Object prop
+ * @type Object
+ */
+
+/**
+ * Extend one object with another, returning the original,
+ * modified, object. This is a great utility for simple inheritance.
+ *
+ * @name $.extend
+ * @param Object obj The object to extend
+ * @param Object prop The object that will be merged into the first.
+ * @type Object
+ * @cat Javascript
+ */
+jQuery.extend = jQuery.fn.extend = function(obj,prop) {
+ if ( !prop ) { prop = obj; obj = this; }
+ for ( var i in prop ) obj[i] = prop[i];
+ return obj;
+};
- /**
- * Get a set of elements containing the unique ancestors of the matched
- * set of elements, and filtered by an expression.
- *
- * @example $("span").ancestors("p")
- * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
- * @result [ <p><span>Hello</span></p> ]
- *
- * @name ancestors
- * @type jQuery
- * @param String expr An expression to filter the ancestors with
- */
- ancestors: jQuery.parents,
+jQuery.extend({
+ /**
+ *
+ *
+ * @private
+ * @name init
+ * @type undefined
+ */
+ init: function(){
+ jQuery.initDone = true;
- /**
- * A synonym for ancestors
- */
- parents: jQuery.parents,
-
- /**
- * 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.
- *
- * @example $("p").next()
- * @before <p>Hello</p><p>Hello Again</p><div><span>And Again</span></div>
- * @result [ <p>Hello Again</p>, <div><span>And Again</span></div> ]
- *
- * @name next
- * @type jQuery
- */
-
- /**
- * Get a set of elements containing the unique next siblings of each of the
- * matched set of elements, and filtered by an expression.
- *
- * It only returns the very next sibling, not all next siblings.
- *
- * @example $("p").next(".selected")
- * @before <p>Hello</p><p class="selected">Hello Again</p><div><span>And Again</span></div>
- * @result [ <p class="selected">Hello Again</p> ]
- *
- * @name next
- * @type jQuery
- * @param String expr An expression to filter the next Elements with
- */
- next: "a.nextSibling",
-
- /**
- * Get a set of elements containing the unique previous siblings of each of the
- * matched set of elements.
- *
- * It only returns the immediately previous sibling, not all previous siblings.
- *
- * @example $("p").previous()
- * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
- * @result [ <div><span>Hello Again</span></div> ]
- *
- * @name prev
- * @type jQuery
- */
-
- /**
- * Get a set of elements containing the unique previous siblings of each of the
- * matched set of elements, and filtered by an expression.
- *
- * It only returns the immediately previous sibling, not all previous siblings.
- *
- * @example $("p").previous("selected")
- * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
- * @result [ <div><span>Hello</span></div> ]
- *
- * @name prev
- * @type jQuery
- * @param String expr An expression to filter the previous Elements with
- */
- prev: "a.previousSibling",
-
- /**
- * Get a set of elements containing all of the unique siblings of each of the
- * matched set of elements.
- *
- * @example $("div").siblings()
- * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
- * @result [ <p>Hello</p>, <p>And Again</p> ]
- *
- * @name siblings
- * @type jQuery
- */
+ jQuery.each( jQuery.macros.axis, function(i,n){
+ jQuery.fn[ i ] = function(a) {
+ var ret = jQuery.map(this,n);
+ if ( a && a.constructor == String )
+ ret = jQuery.filter(a,ret).r;
+ return this.pushStack( ret, arguments );
+ };
+ });
+
+ jQuery.each( jQuery.macros.to, function(i,n){
+ jQuery.fn[ i ] = function(){
+ var a = arguments;
+ return this.each(function(){
+ for ( var j = 0; j < a.length; j++ )
+ $(a[j])[n]( this );
+ });
+ };
+ });
+
+ jQuery.each( jQuery.macros.each, function(i,n){
+ jQuery.fn[ i ] = function() {
+ return this.each( n, arguments );
+ };
+ });
- /**
- * Get a set of elements containing all of the unique siblings of each of the
- * matched set of elements, and filtered by an expression.
- *
- * @example $("div").siblings("selected")
- * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
- * @result [ <p class="selected">Hello Again</p> ]
- *
- * @name siblings
- * @type jQuery
- * @param String expr An expression to filter the sibling Elements with
- */
- siblings: jQuery.sibling
- };
+ jQuery.each( jQuery.macros.filter, function(i,n){
+ jQuery.fn[ n ] = function(num,fn) {
+ return this.filter( ":" + n + "(" + num + ")", fn );
+ };
+ });
+
+ jQuery.each( jQuery.macros.attr, function(i,n){
+ n = n || i;
+ jQuery.fn[ i ] = function(h) {
+ return h == undefined ?
+ this.length ? this[0][n] : null :
+ this.attr( n, h );
+ };
+ });
- for ( var i in axis ) new function(){
- var t = axis[i];
- jQuery.fn[ i ] = function(a) {
- var ret = jQuery.map(this,t);
- if ( a ) ret = jQuery.filter(a,ret).r;
- return this.pushStack( ret, arguments );
- };
- }
+ jQuery.each( jQuery.macros.css, function(i,n){
+ jQuery.fn[ i ] = function(h) {
+ return h == undefined ?
+ ( this.length ? jQuery.css( this[0], n ) : null ) :
+ this.css( n, h );
+ };
+ });
- /*var to = ["append","prepend","before","after"];
+ },
- for ( var i = 0; i < to.length; i++ ) new function(){
- var n = to[i];
- jQuery.fn[ n + "To" ] = function(){
- var a = arguments;
- return this.each(function(){
- for ( var i = 0; i < a.length; i++ )
- $(a[i])[n]( this );
- });
- };
- }*/
+ /**
+ * A generic iterator function, which can be used to seemlessly
+ * iterate over both objects and arrays.
+ *
+ * @name $.each
+ * @param Object obj The object, or array, to iterate over.
+ * @param Object fn The function that will be executed on every object.
+ * @type Object
+ * @cat Javascript
+ */
+ each: function( obj, fn, args ) {
+ if ( obj.length == undefined )
+ for ( var i in obj )
+ fn.apply( obj[i], args || [i, obj[i]] );
+ else
+ for ( var i = 0; i < obj.length; i++ )
+ fn.apply( obj[i], args || [i, obj[i]] );
+ return obj;
+ },
- var each = {
- show: function(){
- this.style.display = this.oldblock ? this.oldblock : "";
- if ( jQuery.css(this,"display") == "none" )
- this.style.display = "block";
- },
-
- hide: function(){
- this.oldblock = jQuery.css(this,"display");
- if ( this.oldblock == "none" )
- this.oldblock = "block";
- this.style.display = "none";
- },
-
- toggle: function(){
- var d = jQuery.css(this,"display");
- $(this)[ !d || d == "none" ? "show" : "hide" ]();
- },
-
- addClass: function(c){
- jQuery.className.add(this,c);
+ className: {
+ add: function(o,c){
+ if (jQuery.className.has(o,c)) return;
+ o.className += ( o.className ? " " : "" ) + c;
},
-
- removeClass: function(c){
- jQuery.className.remove(this,c);
+ remove: function(o,c){
+ o.className = !c ? "" :
+ o.className.replace(
+ new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "");
},
-
- toggleClass: function( c ){
- jQuery.className[ jQuery.className.has(this,a) ? "remove" : "add" ](this,c);
- },
-
- remove: function(a){
- if ( !a || jQuery.filter( [this], a ).r )
- this.parentNode.removeChild( this );
- },
-
- empty: function(){
- while ( this.firstChild )
- this.removeChild( this.firstChild );
- },
-
- bind: function( type, fn ) {
- jQuery.event.add( this, type, fn );
- },
-
- unbind: function( type, fn ) {
- jQuery.event.remove( this, type, fn );
- },
-
- trigger: function( type ) {
- jQuery.event.trigger( this, type );
- }
- };
-
- for ( var i in each ) new function() {
- var n = each[i];
- jQuery.fn[ i ] = function() {
- return this.each( n, arguments );
- };
- };
-
- var attr = {
- val: "value",
- html: "innerHTML",
- value: null,
- id: null,
- title: null,
- name: null,
- href: null,
- src: null,
- rel: null
- };
-
- for ( var i in attr ) new function() {
- var n = attr[i];
- jQuery.fn[ i ] = function(h) {
- return h == undefined ?
- this.length ? this[0][n] : null :
- this.attr( n, h );
- };
- }
-
- var css = "width,height,top,left,position,float,overflow,color,background".split(",");
-
- for ( var i in css ) new function() {
- var n = css[i];
- jQuery.fn[ i ] = function(h) {
- return h == undefined ?
- this.length ? jQuery.css( this[0], n ) : null :
- this.css( n, h );
- };
- }
-
-}
-
-jQuery.extend({
- className: {
- add: function(o,c){
- if (jQuery.className.has(o,c)) return;
- o.className += ( o.className ? " " : "" ) + c;
- },
- remove: function(o,c){
- o.className = !c ? "" :
- o.className.replace(
- new RegExp("(^|\\s*\\b[^-])"+c+"($|\\b(?=[^-]))", "g"), "");
- },
- has: function(e,a) {
- if ( e.className )
- e = e.className;
- return new RegExp("(^|\\s)" + a + "(\\s|$)").test(e);
- }
- },
+ has: function(e,a) {
+ if ( e.className )
+ e = e.className;
+ return new RegExp("(^|\\s)" + a + "(\\s|$)").test(e);
+ }
+ },
/**
* Swap in/out style options.
});
return p == "height" ? oHeight : oWidth;
- }
-
+ } else if ( p == "opacity" && jQuery.browser.msie )
+ return parseFloat( jQuery.curCSS(e,"filter").replace(/[^0-9.]/,"") ) || 1;
+
+ return jQuery.curCSS( e, p );
+ },
+
+ curCSS: function(e,p,force) {
var r;
- if (e.style[p])
+ if (!force && e.style[p])
r = e.style[p];
- else if (e.currentStyle)
+ else if (e.currentStyle) {
+ p = p.replace(/\-(\w)/g,function(m,c){return c.toUpperCase()});
r = e.currentStyle[p];
- else if (document.defaultView && document.defaultView.getComputedStyle) {
+ } else if (document.defaultView && document.defaultView.getComputedStyle) {
p = p.replace(/([A-Z])/g,"-$1").toLowerCase();
var s = document.defaultView.getComputedStyle(e,"");
r = s ? s.getPropertyValue(p) : null;
contains: "(a.innerText||a.innerHTML).indexOf(m[3])>=0",
// Visibility
- visible: "jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",
- hidden: "jQuery.css(a,'display')=='none'||jQuery.css(a,'visibility')=='hidden'",
+ visible: "a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",
+ hidden: "a.type=='hidden'||jQuery.css(a,'display')=='none'||jQuery.css(a,'visibility')=='hidden'",
// Form elements
enabled: "!a.disabled",
find: function( t, context ) {
// Make sure that the context is a DOM Element
- if ( context && context.getElementsByTagName == undefined )
+ if ( context && context.nodeType == undefined )
context = null;
// Set the correct context (if none is provided)
} else
return "";
},
+
+ // The regular expressions that power the parsing engine
+ parse: [
+ // Match: [@value='test'], [@foo]
+ [ "\\[ *(@)S *([!*$^=]*) *Q\\]", 1 ],
+
+ // Match: [div], [div p]
+ [ "(\\[)Q\\]", 0 ],
+
+ // Match: :contains('foo')
+ [ "(:)S\\(Q\\)", 0 ],
+
+ // Match: :even, :last-chlid
+ [ "([:.#]*)S", 0 ]
+ ],
filter: function(t,r,not) {
// Figure out if we're doing regular, or inverse, filtering
var g = not !== false ? jQuery.grep :
function(a,f) {return jQuery.grep(a,f,true);};
- // Look for a string-like sequence
- var str = "([a-zA-Z*_-][a-zA-Z0-9_-]*)";
-
- // Look for something (optionally) enclosed with quotes
- var qstr = " *'?\"?([^'\"]*)'?\"? *";
-
- while ( t && /^[a-zA-Z\[*:.#]/.test(t) ) {
- // Handles:
- // [@foo], [@foo=bar], etc.
- var re = new RegExp("^\\[ *@" + str + " *([!*$^=]*) *" + qstr + "\\]");
- var m = re.exec(t);
-
- // Re-organize the match
- if ( m ) m = ["", "@", m[2], m[1], m[3]];
-
- // Handles:
- // [div], [.foo]
- if ( !m ) {
- re = new RegExp("^(\\[)" + qstr + "\\]");
- m = re.exec(t);
- }
-
- // Handles:
- // :contains(test), :not(.foo)
- if ( !m ) {
- re = new RegExp("^(:)" + str + "\\(" + qstr + "\\)");
- m = re.exec(t);
- }
-
- // Handles:
- // :foo, .foo, #foo, foo
- if ( !m ) {
- re = new RegExp("^([:.#]*)" + str);
- m = re.exec(t);
+ while ( t && /^[a-z[({<*:.#]/i.test(t) ) {
+
+ var p = jQuery.parse;
+
+ for ( var i = 0; i < p.length; i++ ) {
+ var re = new RegExp( "^" + p[i][0]
+
+ // Look for a string-like sequence
+ .replace( 'S', "([a-z*_-][a-z0-9_-]*)" )
+
+ // Look for something (optionally) enclosed with quotes
+ .replace( 'Q', " *'?\"?([^'\"]*)'?\"? *" ), "i" );
+
+ var m = re.exec( t );
+
+ if ( m ) {
+ // Re-organize the match
+ if ( p[i][1] )
+ m = ["", m[1], m[3], m[2], m[4]];
+
+ // Remove what we just matched
+ t = t.replace( re, "" );
+
+ break;
+ }
}
-
- // Remove what we just matched
- t = t.replace( re, "" );
// :not() is a special case that can be optomized by
// keeping it out of the expression list
n == "even" && type.n % 2 == 0 ||
n == "odd" && type.n % 2 ||
type[n] == a;
+ type.prev = type[type.n - 1];
type.next = type[type.n + 1];
return type;
},
},
handle: function(event) {
+ if ( typeof jQuery == "undefined" ) return;
+
event = event || jQuery.event.fix( window.event );
// If no correct event was found, fail
}
});
+
+new function() {
+ var b = navigator.userAgent.toLowerCase();
+
+ // Figure out what browser is being used
+ jQuery.browser = {
+ safari: /webkit/.test(b),
+ opera: /opera/.test(b),
+ msie: /msie/.test(b) && !/opera/.test(b),
+ mozilla: /mozilla/.test(b) && !/compatible/.test(b)
+ };
+
+ // Check to see if the W3C box model is being used
+ jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
+};
+
+jQuery.macros = {
+ to: {
+ /**
+ * Append all of the matched elements to another, specified, set of elements.
+ * This operation is, essentially, the reverse of doing a regular
+ * $(A).append(B), in that instead of appending B to A, you're appending
+ * A to B.
+ *
+ * @example $("p").appendTo("#foo");
+ * @before <p>I would like to say: </p><div id="foo"></div>
+ * @result <div id="foo"><p>I would like to say: </p></div>
+ *
+ * @name appendTo
+ * @type jQuery
+ * @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
+ */
+ appendTo: "append",
+
+ /**
+ * Prepend all of the matched elements to another, specified, set of elements.
+ * This operation is, essentially, the reverse of doing a regular
+ * $(A).prepend(B), in that instead of prepending B to A, you're prepending
+ * A to B.
+ *
+ * @example $("p").prependTo("#foo");
+ * @before <p>I would like to say: </p><div id="foo"><b>Hello</b></div>
+ * @result <div id="foo"><p>I would like to say: </p><b>Hello</b></div>
+ *
+ * @name prependTo
+ * @type jQuery
+ * @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
+ */
+ prependTo: "prepend",
+
+ /**
+ * Insert all of the matched elements before another, specified, set of elements.
+ * This operation is, essentially, the reverse of doing a regular
+ * $(A).before(B), in that instead of inserting B before A, you're inserting
+ * A before B.
+ *
+ * @example $("p").insertBefore("#foo");
+ * @before <div id="foo">Hello</div><p>I would like to say: </p>
+ * @result <p>I would like to say: </p><div id="foo">Hello</div>
+ *
+ * @name insertBefore
+ * @type jQuery
+ * @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
+ */
+ insertBefore: "before",
+
+ /**
+ * Insert all of the matched elements after another, specified, set of elements.
+ * This operation is, essentially, the reverse of doing a regular
+ * $(A).after(B), in that instead of inserting B after A, you're inserting
+ * A after B.
+ *
+ * @example $("p").insertAfter("#foo");
+ * @before <p>I would like to say: </p><div id="foo">Hello</div>
+ * @result <div id="foo">Hello</div><p>I would like to say: </p>
+ *
+ * @name insertAfter
+ * @type jQuery
+ * @param String expr A jQuery expression of elements to match.
+ * @cat DOM/Manipulation
+ */
+ insertAfter: "after"
+ },
+
+ /**
+ * Get the current CSS width of the first matched element.
+ *
+ * @example $("p").width();
+ * @before <p>This is just a test.</p>
+ * @result "300px"
+ *
+ * @name width
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS width of every matched element. Be sure to include
+ * the "px" (or other unit of measurement) after the number that you
+ * specify, otherwise you might get strange results.
+ *
+ * @example $("p").width("20px");
+ * @before <p>This is just a test.</p>
+ * @result <p style="width:20px;">This is just a test.</p>
+ *
+ * @name width
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS height of the first matched element.
+ *
+ * @example $("p").height();
+ * @before <p>This is just a test.</p>
+ * @result "14px"
+ *
+ * @name height
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS height of every matched element. Be sure to include
+ * the "px" (or other unit of measurement) after the number that you
+ * specify, otherwise you might get strange results.
+ *
+ * @example $("p").height("20px");
+ * @before <p>This is just a test.</p>
+ * @result <p style="height:20px;">This is just a test.</p>
+ *
+ * @name height
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS top of the first matched element.
+ *
+ * @example $("p").top();
+ * @before <p>This is just a test.</p>
+ * @result "0px"
+ *
+ * @name top
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS top of every matched element. Be sure to include
+ * the "px" (or other unit of measurement) after the number that you
+ * specify, otherwise you might get strange results.
+ *
+ * @example $("p").top("20px");
+ * @before <p>This is just a test.</p>
+ * @result <p style="top:20px;">This is just a test.</p>
+ *
+ * @name top
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS left of the first matched element.
+ *
+ * @example $("p").left();
+ * @before <p>This is just a test.</p>
+ * @result "0px"
+ *
+ * @name left
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS left of every matched element. Be sure to include
+ * the "px" (or other unit of measurement) after the number that you
+ * specify, otherwise you might get strange results.
+ *
+ * @example $("p").left("20px");
+ * @before <p>This is just a test.</p>
+ * @result <p style="left:20px;">This is just a test.</p>
+ *
+ * @name left
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS position of the first matched element.
+ *
+ * @example $("p").position();
+ * @before <p>This is just a test.</p>
+ * @result "static"
+ *
+ * @name position
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS position of every matched element.
+ *
+ * @example $("p").position("relative");
+ * @before <p>This is just a test.</p>
+ * @result <p style="position:relative;">This is just a test.</p>
+ *
+ * @name position
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS float of the first matched element.
+ *
+ * @example $("p").float();
+ * @before <p>This is just a test.</p>
+ * @result "none"
+ *
+ * @name float
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS float of every matched element.
+ *
+ * @example $("p").float("left");
+ * @before <p>This is just a test.</p>
+ * @result <p style="float:left;">This is just a test.</p>
+ *
+ * @name float
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS overflow of the first matched element.
+ *
+ * @example $("p").overflow();
+ * @before <p>This is just a test.</p>
+ * @result "none"
+ *
+ * @name overflow
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS overflow of every matched element.
+ *
+ * @example $("p").overflow("auto");
+ * @before <p>This is just a test.</p>
+ * @result <p style="overflow:auto;">This is just a test.</p>
+ *
+ * @name overflow
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS color of the first matched element.
+ *
+ * @example $("p").color();
+ * @before <p>This is just a test.</p>
+ * @result "black"
+ *
+ * @name color
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS color of every matched element.
+ *
+ * @example $("p").color("blue");
+ * @before <p>This is just a test.</p>
+ * @result <p style="color:blue;">This is just a test.</p>
+ *
+ * @name color
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ /**
+ * Get the current CSS background of the first matched element.
+ *
+ * @example $("p").background();
+ * @before <p>This is just a test.</p>
+ * @result ""
+ *
+ * @name background
+ * @type String
+ * @cat CSS
+ */
+
+ /**
+ * Set the CSS background of every matched element.
+ *
+ * @example $("p").background("blue");
+ * @before <p>This is just a test.</p>
+ * @result <p style="background:blue;">This is just a test.</p>
+ *
+ * @name background
+ * @type jQuery
+ * @param String val Set the CSS property to the specified value.
+ * @cat CSS
+ */
+
+ css: "width,height,top,left,position,float,overflow,color,background".split(","),
+
+ filter: [ "eq", "lt", "gt", "contains" ],
+
+ attr: {
+ /**
+ * Get the current value of the first matched element.
+ *
+ * @example $("input").val();
+ * @before <input type="text" value="some text"/>
+ * @result "some text"
+ *
+ * @name val
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the value of every matched element.
+ *
+ * @example $("input").value("test");
+ * @before <input type="text" value="some text"/>
+ * @result <input type="text" value="test"/>
+ *
+ * @name val
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ val: "value",
+
+ /**
+ * Get the html contents of the first matched element.
+ *
+ * @example $("div").html();
+ * @before <div><input/></div>
+ * @result <input/>
+ *
+ * @name html
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the html contents of every matched element.
+ *
+ * @example $("div").html("<b>new stuff</b>");
+ * @before <div><input/></div>
+ * @result <div><b>new stuff</b></div>
+ *
+ * @name html
+ * @type jQuery
+ * @param String val Set the html contents to the specified value.
+ * @cat DOM/Attributes
+ */
+ html: "innerHTML",
+
+ /**
+ * Get the current id of the first matched element.
+ *
+ * @example $("input").id();
+ * @before <input type="text" id="test" value="some text"/>
+ * @result "test"
+ *
+ * @name id
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the id of every matched element.
+ *
+ * @example $("input").id("newid");
+ * @before <input type="text" id="test" value="some text"/>
+ * @result <input type="text" id="newid" value="some text"/>
+ *
+ * @name id
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ id: null,
+
+ /**
+ * Get the current title of the first matched element.
+ *
+ * @example $("img").title();
+ * @before <img src="test.jpg" title="my image"/>
+ * @result "my image"
+ *
+ * @name title
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the title of every matched element.
+ *
+ * @example $("img").title("new title");
+ * @before <img src="test.jpg" title="my image"/>
+ * @result <img src="test.jpg" title="new image"/>
+ *
+ * @name title
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ title: null,
+
+ /**
+ * Get the current name of the first matched element.
+ *
+ * @example $("input").name();
+ * @before <input type="text" name="username"/>
+ * @result "username"
+ *
+ * @name name
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the name of every matched element.
+ *
+ * @example $("input").name("user");
+ * @before <input type="text" name="username"/>
+ * @result <input type="text" name="user"/>
+ *
+ * @name name
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ name: null,
+
+ /**
+ * Get the current href of the first matched element.
+ *
+ * @example $("a").href();
+ * @before <a href="test.html">my link</a>
+ * @result "test.html"
+ *
+ * @name href
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the href of every matched element.
+ *
+ * @example $("a").href("test2.html");
+ * @before <a href="test.html">my link</a>
+ * @result <a href="test2.html">my link</a>
+ *
+ * @name href
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ href: null,
+
+ /**
+ * Get the current src of the first matched element.
+ *
+ * @example $("img").src();
+ * @before <img src="test.jpg" title="my image"/>
+ * @result "test.jpg"
+ *
+ * @name src
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the src of every matched element.
+ *
+ * @example $("img").src("test2.jpg");
+ * @before <img src="test.jpg" title="my image"/>
+ * @result <img src="test2.jpg" title="my image"/>
+ *
+ * @name src
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ src: null,
+
+ /**
+ * Get the current rel of the first matched element.
+ *
+ * @example $("a").rel();
+ * @before <a href="test.html" rel="nofollow">my link</a>
+ * @result "nofollow"
+ *
+ * @name rel
+ * @type String
+ * @cat DOM/Attributes
+ */
+
+ /**
+ * Set the rel of every matched element.
+ *
+ * @example $("a").rel("nofollow");
+ * @before <a href="test.html">my link</a>
+ * @result <a href="test.html" rel="nofollow">my link</a>
+ *
+ * @name rel
+ * @type jQuery
+ * @param String val Set the property to the specified value.
+ * @cat DOM/Attributes
+ */
+ rel: null
+ },
+
+ axis: {
+ /**
+ * Get a set of elements containing the unique parents of the matched
+ * set of elements.
+ *
+ * @example $("p").parent()
+ * @before <div><p>Hello</p><p>Hello</p></div>
+ * @result [ <div><p>Hello</p><p>Hello</p></div> ]
+ *
+ * @name parent
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing the unique parents of the matched
+ * set of elements, and filtered by an expression.
+ *
+ * @example $("p").parent(".selected")
+ * @before <div><p>Hello</p></div><div class="selected"><p>Hello Again</p></div>
+ * @result [ <div class="selected"><p>Hello Again</p></div> ]
+ *
+ * @name parent
+ * @type jQuery
+ * @param String expr An expression to filter the parents with
+ * @cat DOM/Traversing
+ */
+ parent: "a.parentNode",
+
+ /**
+ * Get a set of elements containing the unique ancestors of the matched
+ * set of elements.
+ *
+ * @example $("span").ancestors()
+ * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
+ * @result [ <body>...</body>, <div>...</div>, <p><span>Hello</span></p> ]
+ *
+ * @name ancestors
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing the unique ancestors of the matched
+ * set of elements, and filtered by an expression.
+ *
+ * @example $("span").ancestors("p")
+ * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
+ * @result [ <p><span>Hello</span></p> ]
+ *
+ * @name ancestors
+ * @type jQuery
+ * @param String expr An expression to filter the ancestors with
+ * @cat DOM/Traversing
+ */
+ ancestors: jQuery.parents,
+
+ /**
+ * Get a set of elements containing the unique ancestors of the matched
+ * set of elements.
+ *
+ * @example $("span").ancestors()
+ * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
+ * @result [ <body>...</body>, <div>...</div>, <p><span>Hello</span></p> ]
+ *
+ * @name parents
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing the unique ancestors of the matched
+ * set of elements, and filtered by an expression.
+ *
+ * @example $("span").ancestors("p")
+ * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
+ * @result [ <p><span>Hello</span></p> ]
+ *
+ * @name parents
+ * @type jQuery
+ * @param String expr An expression to filter the ancestors with
+ * @cat DOM/Traversing
+ */
+ parents: jQuery.parents,
+
+ /**
+ * 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.
+ *
+ * @example $("p").next()
+ * @before <p>Hello</p><p>Hello Again</p><div><span>And Again</span></div>
+ * @result [ <p>Hello Again</p>, <div><span>And Again</span></div> ]
+ *
+ * @name next
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing the unique next siblings of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * It only returns the very next sibling, not all next siblings.
+ *
+ * @example $("p").next(".selected")
+ * @before <p>Hello</p><p class="selected">Hello Again</p><div><span>And Again</span></div>
+ * @result [ <p class="selected">Hello Again</p> ]
+ *
+ * @name next
+ * @type jQuery
+ * @param String expr An expression to filter the next Elements with
+ * @cat DOM/Traversing
+ */
+ next: "jQuery.sibling(a).next",
+
+ /**
+ * Get a set of elements containing the unique previous siblings of each of the
+ * matched set of elements.
+ *
+ * It only returns the immediately previous sibling, not all previous siblings.
+ *
+ * @example $("p").previous()
+ * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
+ * @result [ <div><span>Hello Again</span></div> ]
+ *
+ * @name prev
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing the unique previous siblings of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * It only returns the immediately previous sibling, not all previous siblings.
+ *
+ * @example $("p").previous(".selected")
+ * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
+ * @result [ <div><span>Hello</span></div> ]
+ *
+ * @name prev
+ * @type jQuery
+ * @param String expr An expression to filter the previous Elements with
+ * @cat DOM/Traversing
+ */
+ prev: "jQuery.sibling(a).prev",
+
+ /**
+ * Get a set of elements containing all of the unique siblings of each of the
+ * matched set of elements.
+ *
+ * @example $("div").siblings()
+ * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
+ * @result [ <p>Hello</p>, <p>And Again</p> ]
+ *
+ * @name siblings
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing all of the unique siblings of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * @example $("div").siblings(".selected")
+ * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
+ * @result [ <p class="selected">Hello Again</p> ]
+ *
+ * @name siblings
+ * @type jQuery
+ * @param String expr An expression to filter the sibling Elements with
+ * @cat DOM/Traversing
+ */
+ siblings: jQuery.sibling,
+
+
+ /**
+ * Get a set of elements containing all of the unique children of each of the
+ * matched set of elements.
+ *
+ * @example $("div").children()
+ * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
+ * @result [ <span>Hello Again</span> ]
+ *
+ * @name children
+ * @type jQuery
+ * @cat DOM/Traversing
+ */
+
+ /**
+ * Get a set of elements containing all of the unique children of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * @example $("div").children(".selected")
+ * @before <div><span>Hello</span><p class="selected">Hello Again</p><p>And Again</p></div>
+ * @result [ <p class="selected">Hello Again</p> ]
+ *
+ * @name children
+ * @type jQuery
+ * @param String expr An expression to filter the child Elements with
+ * @cat DOM/Traversing
+ */
+ children: "a.childNodes"
+ },
+
+ each: {
+ /**
+ * Displays each of the set of matched elements if they are hidden.
+ *
+ * @example $("p").show()
+ * @before <p style="display: none">Hello</p>
+ * @result [ <p style="display: block">Hello</p> ]
+ *
+ * @name show
+ * @type jQuery
+ * @cat Effects
+ */
+ _show: function(){
+ this.style.display = this.oldblock ? this.oldblock : "";
+ if ( jQuery.css(this,"display") == "none" )
+ this.style.display = "block";
+ },
+
+ /**
+ * Hides each of the set of matched elements if they are shown.
+ *
+ * @example $("p").hide()
+ * @before <p>Hello</p>
+ * @result [ <p style="display: none">Hello</p> ]
+ *
+ * @name hide
+ * @type jQuery
+ * @cat Effects
+ */
+ _hide: function(){
+ this.oldblock = this.oldblock || jQuery.css(this,"display");
+ if ( this.oldblock == "none" )
+ this.oldblock = "block";
+ this.style.display = "none";
+ },
+
+ /**
+ * Toggles each of the set of matched elements. If they are shown,
+ * toggle makes them hidden. If they are hidden, toggle
+ * makes them shown.
+ *
+ * @example $("p").toggle()
+ * @before <p>Hello</p><p style="display: none">Hello Again</p>
+ * @result [ <p style="display: none">Hello</p>, <p style="display: block">Hello Again</p> ]
+ *
+ * @name toggle
+ * @type jQuery
+ * @cat Effects
+ */
+ _toggle: function(){
+ var d = jQuery.css(this,"display");
+ $(this)[ !d || d == "none" ? "show" : "hide" ]();
+ },
+
+ /**
+ * Adds the specified class to each of the set of matched elements.
+ *
+ * @example $("p").addClass("selected")
+ * @before <p>Hello</p>
+ * @result [ <p class="selected">Hello</p> ]
+ *
+ * @name addClass
+ * @type jQuery
+ * @param String class A CSS class to add to the elements
+ * @cat DOM
+ */
+ addClass: function(c){
+ jQuery.className.add(this,c);
+ },
+
+ /**
+ * Removes the specified class from the set of matched elements.
+ *
+ * @example $("p").removeClass("selected")
+ * @before <p class="selected">Hello</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name removeClass
+ * @type jQuery
+ * @param String class A CSS class to remove from the elements
+ * @cat DOM
+ */
+ removeClass: function(c){
+ jQuery.className.remove(this,c);
+ },
+
+ /**
+ * Adds the specified class if it is present, removes it if it is
+ * not present.
+ *
+ * @example $("p").toggleClass("selected")
+ * @before <p>Hello</p><p class="selected">Hello Again</p>
+ * @result [ <p class="selected">Hello</p>, <p>Hello Again</p> ]
+ *
+ * @name toggleClass
+ * @type jQuery
+ * @param String class A CSS class with which to toggle the elements
+ * @cat DOM
+ */
+ toggleClass: function( c ){
+ jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this,c);
+ },
+
+ /**
+ * Removes all matched elements from the DOM. This does NOT remove them from the
+ * jQuery object, allowing you to use the matched elements further.
+ *
+ * @example $("p").remove();
+ * @before <p>Hello</p> how are <p>you?</p>
+ * @result how are
+ *
+ * @name remove
+ * @type jQuery
+ * @cat DOM/Manipulation
+ */
+
+ /**
+ * Removes only elements (out of the list of matched elements) that match
+ * the specified jQuery expression. This does NOT remove them from the
+ * jQuery object, allowing you to use the matched elements further.
+ *
+ * @example $("p").remove(".hello");
+ * @before <p class="hello">Hello</p> how are <p>you?</p>
+ * @result how are <p>you?</p>
+ *
+ * @name remove
+ * @type jQuery
+ * @param String expr A jQuery expression to filter elements by.
+ * @cat DOM/Manipulation
+ */
+ remove: function(a){
+ if ( !a || jQuery.filter( [this], a ).r )
+ this.parentNode.removeChild( this );
+ },
+
+ /**
+ * Removes all child nodes from the set of matched elements.
+ *
+ * @example $("p").empty()
+ * @before <p>Hello, <span>Person</span> <a href="#">and person</a></p>
+ * @result [ <p></p> ]
+ *
+ * @name empty
+ * @type jQuery
+ * @cat DOM/Manipulation
+ */
+ empty: function(){
+ while ( this.firstChild )
+ this.removeChild( this.firstChild );
+ },
+
+ /**
+ * Binds a particular event (like click) to a each of a set of match elements.
+ *
+ * @example $("p").bind( "click", function() { alert("Hello"); } )
+ * @before <p>Hello</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * Cancel a default action and prevent it from bubbling by returning false
+ * from your function.
+ *
+ * @example $("form").bind( "submit", function() { return false; } )
+ *
+ * Cancel a default action by using the preventDefault method.
+ *
+ * @example $("form").bind( "submit", function() { e.preventDefault(); } )
+ *
+ * Stop an event from bubbling by using the stopPropogation method.
+ *
+ * @example $("form").bind( "submit", function() { e.stopPropogation(); } )
+ *
+ * @name bind
+ * @type jQuery
+ * @param String type An event type
+ * @param Function fn A function to bind to the event on each of the set of matched elements
+ * @cat Events
+ */
+ bind: function( type, fn ) {
+ if ( fn.constructor == String )
+ fn = new Function("e", ( !fn.indexOf(".") ? "$(this)" : "return " ) + fn);
+ jQuery.event.add( this, type, fn );
+ },
+
+ /**
+ * The opposite of bind, removes a bound event from each of the matched
+ * elements. You must pass the identical function that was used in the original
+ * bind method.
+ *
+ * @example $("p").unbind( "click", function() { alert("Hello"); } )
+ * @before <p onclick="alert('Hello');">Hello</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name unbind
+ * @type jQuery
+ * @param String type An event type
+ * @param Function fn A function to unbind from the event on each of the set of matched elements
+ * @cat Events
+ */
+
+ /**
+ * Removes all bound events of a particular type from each of the matched
+ * elements.
+ *
+ * @example $("p").unbind( "click" )
+ * @before <p onclick="alert('Hello');">Hello</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name unbind
+ * @type jQuery
+ * @param String type An event type
+ * @cat Events
+ */
+
+ /**
+ * Removes all bound events from each of the matched elements.
+ *
+ * @example $("p").unbind()
+ * @before <p onclick="alert('Hello');">Hello</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name unbind
+ * @type jQuery
+ * @cat Events
+ */
+ unbind: function( type, fn ) {
+ jQuery.event.remove( this, type, fn );
+ },
+
+ /**
+ * Trigger a type of event on every matched element.
+ *
+ * @example $("p").trigger("click")
+ * @before <p click="alert('hello')">Hello</p>
+ * @result alert('hello')
+ *
+ * @name trigger
+ * @type jQuery
+ * @param String type An event type to trigger.
+ * @cat Events
+ */
+ trigger: function( type, data ) {
+ jQuery.event.trigger( type, data, this );
+ }
+ }
+};