X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=f64835a08a2b8a143b23119131f11206fd7ce911;hb=45a3c06e8fd4ac04f5d914ecf5d2e25148160b3b;hp=63d795c0c81724ffa59beafae78d79765e9af5d2;hpb=48ec10044f011ccfe9bd232d629682b59cccbd97;p=jquery.git
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 63d795c..f64835a 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -69,7 +69,7 @@ function jQuery(a,c) {
}
// Map over the $ in case of overwrite
-if ( $ )
+if ( typeof $ != "undefined" )
jQuery._$ = $;
// Map the jQuery namespace to the '$' one
@@ -193,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
*
@@ -370,8 +378,9 @@ jQuery.fn = jQuery.prototype = {
for ( var j = 0; j < e.length; j++ ) {
var r = e[j].childNodes;
for ( var i = 0; i < r.length; i++ )
- t += r[i].nodeType != 1 ?
- r[i].nodeValue : jQuery.fn.text([ r[i] ]);
+ if ( r[i].nodeType != 8 )
+ t += r[i].nodeType != 1 ?
+ r[i].nodeValue : jQuery.fn.text([ r[i] ]);
}
return t;
},
@@ -629,6 +638,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
@@ -666,7 +676,7 @@ jQuery.fn = jQuery.prototype = {
* @name add
* @type jQuery
* @param Array els An array of Elements to add
- * @cat jQuery
+ * @cat DOM/Traversing
*/
/**
@@ -680,7 +690,7 @@ jQuery.fn = jQuery.prototype = {
* @name add
* @type jQuery
* @param Element el An Element to add
- * @cat jQuery
+ * @cat DOM/Traversing
*/
add: function(t) {
return this.pushStack( jQuery.merge( this, t.constructor == String ?
@@ -695,7 +705,7 @@ jQuery.fn = jQuery.prototype = {
* @member jQuery
* @param {String} expr The expression with which to filter
* @type Boolean
- * @cat jQuery
+ * @cat DOM/Traversing
*/
is: function(expr) {
return expr ? jQuery.filter(expr,this).r.length > 0 : this.length > 0;
@@ -1016,6 +1026,7 @@ jQuery.extend({
odd: "i%2",
// Child Checks
+ "nth-child": "jQuery.sibling(a,m[3]).cur",
"first-child": "jQuery.sibling(a,0).cur",
"last-child": "jQuery.sibling(a,0).last",
"only-child": "jQuery.sibling(a).length==1",
@@ -1188,6 +1199,8 @@ jQuery.extend({
var foundToken = false;
for ( var i = 0; i < jQuery.token.length; i += 2 ) {
+ if ( foundToken ) continue;
+
var re = new RegExp("^(" + jQuery.token[i] + ")");
var m = re.exec(t);
@@ -1224,12 +1237,12 @@ jQuery.extend({
);
}
}
- }
- if ( t ) {
- var val = jQuery.filter(t,r);
- ret = r = val.r;
- t = jQuery.trim(val.t);
+ if ( t ) {
+ var val = jQuery.filter(t,r);
+ ret = r = val.r;
+ t = jQuery.trim(val.t);
+ }
}
}
@@ -1256,7 +1269,9 @@ jQuery.extend({
"class": "className",
"float": "cssFloat",
innerHTML: "innerHTML",
- className: "className"
+ className: "className",
+ value: "value",
+ disabled: "disabled"
};
if ( fix[name] ) {
@@ -2201,7 +2216,7 @@ jQuery.macros = {
/**
* Get a set of elements containing the unique ancestors of the matched
- * set of elements.
+ * set of elements (except for the root element).
*
* @example $("span").ancestors()
* @before
@@ -2229,7 +2244,7 @@ jQuery.macros = {
/**
* Get a set of elements containing the unique ancestors of the matched
- * set of elements.
+ * set of elements (except for the root element).
*
* @example $("span").ancestors()
* @before
@@ -2374,7 +2389,7 @@ jQuery.macros = {
* @param String expr An expression to filter the child Elements with
* @cat DOM/Traversing
*/
- children: "a.childNodes"
+ children: "jQuery.sibling(a.firstChild)"
},
each: {
@@ -2540,7 +2555,7 @@ jQuery.macros = {
* @cat DOM/Manipulation
*/
remove: function(a){
- if ( !a || jQuery.filter( [this], a ).r )
+ if ( !a || jQuery.filter( a, [this] ).r )
this.parentNode.removeChild( this );
},
@@ -2655,4 +2670,4 @@ jQuery.macros = {
}
};
-jQuery.init();
\ No newline at end of file
+jQuery.init();