function jQuery(a,c) {
// Shortcut for document ready (because $(document).each() is silly)
- if ( a && a.constructor == Function )
- return $(document).ready(a);
+ if ( a && a.constructor == Function && jQuery.fn.ready )
+ return jQuery(document).ready(a);
// Make sure t hat a selection was provided
a = a || jQuery.context || document;
* 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 )
// Watch for when a jQuery object is passed at the context
if ( c && c.jquery )
- return $(c.get()).find(a);
+ return jQuery(c.get()).find(a);
// If the context is global, return a new object
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[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 ) );
get: function( num ) {
// Watch for when an array (of elements) is passed in
if ( num && num.constructor == Array ) {
-
+
// Use a tricky hack to make the jQuery object
// look and feel like an array
this.length = 0;
// 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
* @type jQuery
* @param Function fn A function to execute
*/
- each: function( fn ) {
+ 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], [i] );
+ fn.apply( this[i], args || [i] );
return this;
},
* @param Object value The value to set the property to.
*/
css: function( key, value ) {
- return this.attr( key, value, "css" );
+ return this.attr( key, value, "curCSS" );
},
/**
},
/**
- * End all 'destructive' operations, reverting the list of matched elements.
- * After an end operation, the list of matched elements will revert to the last
- * state of matched elements.
+ * End the most recent 'destructive' operation, reverting the list of matched elements
+ * back to its previous state. After an end operation, the list of matched elements will
+ * revert to the last state of matched elements.
*
* @example $("p").find("span").end();
* @before <p><span>Hello</span>, how are you?</p>
return this.get( this.stack.pop() );
},
+ /**
+ * Searches for all elements that match the specified expression.
+ * This method is the optimal way of finding additional descendant
+ * elements with which to process.
+ *
+ * All searching is done using a jQuery expression. The expression can be
+ * written using CSS 1-3 Selector syntax, or basic XPath.
+ *
+ * @example $("p").find("span");
+ * @before <p><span>Hello</span>, how are you?</p>
+ * @result $("p").find("span") == [ <span>Hello</span> ]
+ *
+ * @name find
+ * @type jQuery
+ * @param String expr An expression to search with.
+ */
find: function(t) {
return this.pushStack( jQuery.map( this, function(a){
return jQuery.find(t,a);
}), arguments );
},
+ /**
+ * Removes all elements from the set of matched elements that do not
+ * match the specified expression. This method is used to narrow down
+ * the results of a search.
+ *
+ * All searching is done using a jQuery expression. The expression
+ * can be written using CSS 1-3 Selector syntax, or basic XPath.
+ *
+ * @example $("p").filter(".selected")
+ * @before <p class="selected">Hello</p><p>How are you?</p>
+ * @result $("p").filter(".selected") == [ <p class="selected">Hello</p> ]
+ *
+ * @name filter
+ * @type jQuery
+ * @param String expr An expression to search with.
+ */
+
+ /**
+ * 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
+ */
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 );
},
+ /**
+ * Removes the specified Element from the set of matched elements. This
+ * method is used to remove a single Element from a jQuery object.
+ *
+ * @example $("p").not( document.getElementById("selected") )
+ * @before <p>Hello</p><p id="selected">Hello Again</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name not
+ * @type jQuery
+ * @param Element el An element to remove from the set
+ */
+
+ /**
+ * Removes elements matching the specified expression from the set
+ * of matched elements. This method is used to remove one or more
+ * elements from a jQuery object.
+ *
+ * @example $("p").not("#selected")
+ * @before <p>Hello</p><p id="selected">Hello Again</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name not
+ * @type jQuery
+ * @param String expr An expression with which to remove matching elements
+ */
not: function(t) {
return this.pushStack( t.constructor == String ?
jQuery.filter(t,this,false).r :
jQuery.grep(this,function(a){ return a != t; }), arguments );
},
-
+
+ /**
+ * Adds the elements matched by the expression to the jQuery object. This
+ * can be used to concatenate the result sets of two expressions.
+ *
+ * @example $("p").add("span")
+ * @before <p>Hello</p><p><span>Hello Again</span></p>
+ * @result [ <p>Hello</p>, <span>Hello Again</span> ]
+ *
+ * @name add
+ * @type jQuery
+ * @param String expr An expression whose matched elements are added
+ */
+
+ /**
+ * Adds each of the Elements in the array to the set of matched elements.
+ * This is used to add a set of Elements to a jQuery object.
+ *
+ * @example $("p").add([document.getElementById("a"), document.getElementById("b")])
+ * @before <p>Hello</p><p><span id="a">Hello Again</span><span id="b">And Again</span></p>
+ * @result [ <p>Hello</p>, <span id="a">Hello Again</span>, <span id="b">And Again</span> ]
+ *
+ * @name add
+ * @type jQuery
+ * @param Array<Element> els An array of Elements 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
+ */
add: function(t) {
return this.pushStack( jQuery.merge( this, t.constructor == String ?
jQuery.find(t) : t.constructor == Array ? t : [t] ), arguments );
* @type Boolean
*/
is: function(expr) {
- return jQuery.filter(expr,this).r.length > 0;
+ return expr ? jQuery.filter(expr,this).r.length > 0 : this.length > 0;
},
/**
- * :-P
+ *
*
* @private
* @name domManip
} else
obj = tbody[0];
}
-
+ //alert( obj );
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] ] );
+ //alert( fn );
+ }
});
},
return this;
},
- extend: function(obj,prop) {\r if ( !prop ) {\r prop = obj;\r obj = this;\r }\r \r for ( var i in prop )\r obj[i] = prop[i];\r \r return obj;\r }
+ 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;
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",
- parents: 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 ancestors
+ * @type jQuery
+ */
+
+ /**
+ * 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,
- next: "a.nextSibling",
- prev: "a.previousSibling",
+
+ /**
+ * 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: "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
+ */
+
+ /**
+ * 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: "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
+ */
+
+ /**
+ * 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
};
var t = axis[i];
jQuery.fn[ i ] = function(a) {
var ret = jQuery.map(this,t);
- if ( a ) ret = jQuery.filter(a,ret).r;
+ if ( a && a.constructor == String )
+ ret = jQuery.filter(a,ret).r;
return this.pushStack( ret, arguments );
};
- }
+ };
+
+ // appendTo, prependTo, beforeTo, afterTo
- /*var to = ["append","prepend","before","after"];
+ var to = ["append","prepend","before","after"];
for ( var i = 0; i < to.length; i++ ) new function(){
var n = to[i];
$(a[i])[n]( this );
});
};
- }*/
+ };
var 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
+ */
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
+ */
hide: function(){
this.oldblock = jQuery.css(this,"display");
if ( this.oldblock == "none" )
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
+ */
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
+ */
addClass: function(c){
jQuery.className.add(this,c);
},
+ /**
+ * The opposite of addClass. 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
+ */
removeClass: function(c){
jQuery.className.remove(this,c);
},
+ /**
+ * Adds the specified class if it is present. Remove 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
+ */
toggleClass: function( c ){
- jQuery.className[ jQuery.className.has(this,a) ? "remove" : "add" ](this,c);
+ jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this,c);
},
+ /**
+ * TODO: Document
+ */
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
+ */
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
+ */
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 a set of 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>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
+ */
unbind: function( type, fn ) {
jQuery.event.remove( this, type, fn );
},
- trigger: function( type ) {
- jQuery.event.trigger( this, type );
+ /**
+ * Trigger a particular event.
+ *
+ * @example $("p").trigger("click")
+ * @before <p>Hello</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name trigger
+ * @type jQuery
+ * @param String type An event type
+ */
+ trigger: function( type, data ) {
+ jQuery.event.trigger( type, data, this );
}
};
for ( var i in each ) new function() {
var n = each[i];
jQuery.fn[ i ] = function() {
- var args = arguments;
- return this.each(function(){
- n.apply( this, args );
- });
+ return this.each( n, arguments );
};
- }
+ };
var attr = {
val: "value",
};
for ( var i in attr ) new function() {
- var n = attr[i];
+ var n = attr[i] || 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(",");
-
+ };
+
+ 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.length ? jQuery.css( this[0], n ) : null ) :
this.css( n, h );
};
- }
+ };
}
return p == "height" ? oHeight : oWidth;
}
-
+
+ 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)
r = e.currentStyle[p];
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)
if ( m ) {
r = ret = jQuery.map( ret, jQuery.token[i+1] );
- t = jQuery.trim(t).replace( re, "" );
+ t = jQuery.trim( t.replace( re, "" ) );
foundToken = true;
}
}
} 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
// Otherwise, find the expression to execute
else {
+ var f = jQuery.expr[m[1]];
+ if ( f.constructor != String )
+ f = jQuery.expr[m[1]][m[2]];
+
// Build a custom macro to enclose it
eval("f = function(a,i){" +
( m[1] == "@" ? "z=jQuery.attr(a,m[3]);" : "" ) +
- "return " + jQuery.expr[m[1]] + "}");
+ "return " + f + "}");
// Execute it against the current filter
r = g( r, f );
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;
},
if (element["on" + type])
handlers[0] = element["on" + type];
}
-
+
// Add the function to the element's handler list
handlers[handler.guid] = handler;
if ( !event ) return;
var returnValue = true;
+
+ var c = this.events[event.type];
- for ( var j in this.events[event.type] ) {
- if (this.events[event.type][j](event) === false) {
+ for ( var j in c ) {
+ if ( c[j].apply( this, [event] ) === false ) {
event.preventDefault();
event.stopPropagation();
returnValue = false;
}
}
-});
\ No newline at end of file
+});