X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=115ee7f2d70274f81f43ae81829dde825fe089c3;hb=c0e4280282d03a449caaf87d5a6bfe151a874796;hp=3dd9b5c0cadd0a61ce704abe86ac9270eea3d21e;hpb=a2af24b064bd1384c24b896fdd9c7d322954546b;p=jquery.git
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 3dd9b5c..115ee7f 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -29,9 +29,6 @@ window.undefined = window.undefined;
*/
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);
@@ -39,25 +36,6 @@ function jQuery(a,c) {
// Make sure that 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 &&
-
- // Make sure that the expression is a colliding one
- !/[^a-zA-Z0-9_-]/.test(a) &&
-
- // and that there are no elements that match it
- // (this is the one truly ambiguous case)
- !document.getElementsByTagName(a).length )
-
- // 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 )
return $( jQuery.merge( a, [] ) );
@@ -82,13 +60,16 @@ function jQuery(a,c) {
// Find the matching elements and save them for later
jQuery.find( a, c ) );
+ // See if an extra function was provided
var fn = arguments[ arguments.length - 1 ];
+
+ // If so, execute it in context
if ( fn && fn.constructor == Function )
this.each(fn);
}
// Map over the $ in case of overwrite
-if ( $ )
+if ( typeof $ != "undefined" )
jQuery._$ = $;
// Map the jQuery namespace to the '$' one
@@ -212,7 +193,15 @@ jQuery.fn = jQuery.prototype = {
* argument representing the position of the element in the matched
* set.
*
- * @example $("img").each(function(){ this.src = "test.jpg"; });
+ * @example $("img").each(function(){
+ * this.src = "test.jpg";
+ * });
+ * @before
+ * @result
+ *
+ * @example $("img").each(function(i){
+ * alert( "Image #" + i + " is " + this );
+ * });
* @before
* @result
*
@@ -648,6 +637,7 @@ jQuery.fn = jQuery.prototype = {
* @example $("p").not("#selected")
* @before
Hello
Hello Again
* @result [Hello
] + * @test cmpOK($("#main > p#ap > a").not("#google").length, "==", 2, ".not") * * @name not * @type jQuery @@ -685,7 +675,7 @@ jQuery.fn = jQuery.prototype = { * @name add * @type jQuery * @param ArrayHello
Hello AgainHello
Hello Again