r1536 - trunk
r1536 - trunk
Author: scott.gonzalez
Date: Wed Jan 7 07:00:32 2009
New Revision: 1536
Modified:
trunk/jquery-1.3pre.js
Log:
Updated jQuery 1.3pre to r6065 (post 1.3b2)
Modified: trunk/jquery-1.3pre.js
==============================================================================
--- trunk/jquery-1.3pre.js (original)
+++ trunk/jquery-1.3pre.js Wed Jan 7 07:00:32 2009
@@ -1,34 +1,36 @@
-(function(){
-/*
- * jQuery 1.3b2pre - New Wave Javascript
+/*!
+ * jQuery JavaScript Library v1.3b2
+ * http://jquery.com/
*
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
*
- * $Date: 2009-01-02 19:51:07 -0500 (Fri, 02 Jan 2009) $
- * $Rev: 6026 $
+ * Date:
+ * Revision: 6065
*/
+(function(){
-// Map over jQuery in case of overwrite
-var _jQuery = window.jQuery,
-// Map over the $ in case of overwrite
- _$ = window.$;
-
-var jQuery = window.jQuery = window.$ = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context );
-};
-
-// 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 selector
- isSimple = /^.[^:#\[\.,]*$/,
-
-// Will speed up references to undefined, and allows munging its name.
- undefined;
+var
+ // Will speed up references to window, and allows munging its name.
+ window = this,
+ // Will speed up references to undefined, and allows munging its name.
+ undefined,
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ jQuery = window.jQuery = window.$ = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
+ // Is it a simple selector
+ isSimple = /^.[^:#\[\.,]*$/;
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
@@ -91,7 +93,7 @@
selector: "",
// The current version of jQuery being used
- jquery: "1.3b2pre",
+ jquery: "1.3b2",
// The number of elements contained in the matched element set
size: function() {
@@ -271,14 +273,23 @@
return this.prevObject || jQuery( [] );
},
+ push: [].push,
+
find: function( selector ) {
- var elems = jQuery.map(this, function(elem){
- return jQuery.find( selector, elem );
- });
+ if ( this.length === 1 && !/,/.test(selector) ) {
+ var ret = this.pushStack( [], "find", selector );
+ ret.length = 0;
+ jQuery.find( selector, this[0], ret );
+ return ret;
+ } else {
+ var elems = jQuery.map(this, function(elem){
+ return jQuery.find( selector, elem );
+ });
- return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
- jQuery.unique( elems ) :
- elems, "find", selector );
+ return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
+ jQuery.unique( elems ) :
+ elems, "find", selector );
+ }
},
clone: function( events ) {
@@ -486,11 +497,11 @@
domManip: function( args, table, callback ) {
if ( this[0] ) {
- var fragment = this[0].ownerDocument.createDocumentFragment(),
- scripts = jQuery.clean( args, this[0].ownerDocument, fragment ),
+ var fragment = (this[0].ownerDocument ||
this[0]).createDocumentFragment(),
+ scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]),
fragment ),
first = fragment.firstChild,
extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
-
+
if ( first )
for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) :
fragment );
@@ -823,7 +834,7 @@
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
- var match = /^<(\w+)\/?>$/.exec(elems[0]);
+ var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
if ( match )
return [ context.createElement( match[1] ) ];
}
@@ -905,15 +916,6 @@
if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ),
div.firstChild );
- if ( fragment ) {
- var found = div.getElementsByTagName("script");
-
- while ( found.length ) {
- scripts.push( found[0] );
- found[0].parentNode.removeChild( found[0] );
- }
- }
-
elem = jQuery.makeArray( div.childNodes );
}
@@ -926,14 +928,12 @@
if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
- var node = ret[i];
- if ( jQuery.nodeName( node, "script" ) ) {
- if( node.parentNode )
- node.parentNode.removeChild( node );
+ if ( jQuery.nodeName( ret[i], "script" ) ) {
+ scripts.push( ret[i].parentNode.removeChild( ret[i] ) );
} else {
- if ( node.nodeType === 1 )
- ret = jQuery.merge( ret, node.getElementsByTagName("script"));
- fragment.appendChild( node );
+ if ( ret[i].nodeType === 1 )
+ ret.splice.apply( ret, [i + 1,
0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+ fragment.appendChild( ret[i] );
}
}
@@ -981,6 +981,17 @@
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
return elem.getAttributeNode( name ).nodeValue;
+ // elem.tabIndex doesn't always return the correct value when it
hasn't been explicitly set
+ //
http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ if ( name == "tabIndex" ) {
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
+ return attributeNode && attributeNode.specified
+ ? attributeNode.value
+ : elem.nodeName.match(/^(a|area|button|input|object|select|
textarea)$/i)
+ ? 0
+ : undefined;
+ }
+
return elem[ name ];
}
@@ -1474,7 +1485,8 @@
readonly: "readOnly",
maxlength: "maxLength",
cellspacing: "cellSpacing",
- rowspan: "rowSpan"
+ rowspan: "rowSpan",
+ tabindex: "tabIndex"
};
/*
* Sizzle CSS Selector Engine - v0.9
@@ -1483,11 +1495,12 @@
*/
(function(){
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]+\]|[^[\]]+)+\]|
\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g;
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|
\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g;
var done = 0;
var Sizzle = function(selector, context, results, seed) {
+ var doCache = !results;
results = results || [];
context = context || document;
@@ -1498,7 +1511,7 @@
return results;
}
- var parts = [], m, set, checkSet, check, mode, extra;
+ var parts = [], m, set, checkSet, check, mode, extra, prune = true;
// Reset the position of the chunker regexp (start from head)
chunker.lastIndex = 0;
@@ -1550,6 +1563,8 @@
if ( parts.length > 0 ) {
checkSet = makeArray(set);
+ } else {
+ prune = false;
}
while ( parts.length ) {
@@ -1578,7 +1593,9 @@
}
if ( checkSet instanceof Array ) {
- if ( context.nodeType === 1 ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+ } else if ( context.nodeType === 1 ) {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType ===
1 && contains(context, checkSet[i])) ) {
results.push( set[i] );
@@ -1596,7 +1613,7 @@
}
if ( extra ) {
- Sizzle( extra, context, results );
+ Sizzle( extra, context, results, seed );
}
return results;
@@ -1613,23 +1630,8 @@
return [];
}
- var later = "", match;
-
- // Pseudo-selectors could contain other selectors (like :not)
- while ( (match = Expr.match.PSEUDO.exec( expr )) ) {
- var left = RegExp.leftContext;
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- later += match[0];
- expr = expr.replace( Expr.match.PSEUDO, "" );
- } else {
- // TODO: Need a better solution, fails: .class\:foo:realfoo(#id)
- break;
- }
- }
-
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
- var type = Expr.order[i];
+ var type = Expr.order[i], match;
if ( (match = Expr.match[ type ].exec( expr )) ) {
var left = RegExp.leftContext;
@@ -1637,7 +1639,6 @@
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
set = Expr.find[ type ]( match, context );
-
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
@@ -1650,27 +1651,28 @@
set = context.getElementsByTagName("*");
}
- expr += later;
-
return {set: set, expr: expr};
};
-Sizzle.filter = function(expr, set, inplace){
- var old = expr, result = [], curLoop = set, match;
+Sizzle.filter = function(expr, set, inplace, not){
+ var old = expr, result = [], curLoop = set, match, anyFound;
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.match[ type ].exec( expr )) != null ) {
- var anyFound = false, filter = Expr.filter[ type ], goodArray = null;
+ var filter = Expr.filter[ type ], goodArray = null, goodPos = 0,
found, item;
+ anyFound = false;
if ( curLoop == result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop );
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not
);
- if ( match[0] === true ) {
+ if ( !match ) {
+ anyFound = found = true;
+ } else if ( match[0] === true ) {
goodArray = [];
var last = null, elem;
for ( var i = 0; (elem = curLoop[i]) !== undefined; i++ ) {
@@ -1680,26 +1682,28 @@
}
}
}
-
}
- var goodPos = 0, found, item;
-
- for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) {
- if ( item ) {
- if ( goodArray && item != goodArray[goodPos] ) {
- goodPos++;
- }
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) {
+ if ( item ) {
+ if ( goodArray && item != goodArray[goodPos] ) {
+ goodPos++;
+ }
+
+ found = filter( item, match, goodPos, goodArray );
+ var pass = not ^ !!found;
- found = filter( item, match, goodPos, goodArray );
- if ( inplace && found != null ) {
- curLoop[i] = found ? curLoop[i] : false;
- if ( found ) {
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+ } else {
+ curLoop[i] = false;
+ }
+ } else if ( pass ) {
+ result.push( item );
anyFound = true;
}
- } else if ( found ) {
- result.push( item );
- anyFound = true;
}
}
}
@@ -1720,12 +1724,15 @@
}
}
-
expr = expr.replace(/\s*,\s*/, "");
// Improper expression
if ( expr == old ) {
- throw "Syntax error, unrecognized expression: " + expr;
+ if ( anyFound == null ) {
+ throw "Syntax error, unrecognized expression: " + expr;
+ } else {
+ break;
+ }
}
old = expr;
@@ -1739,8 +1746,8 @@
match: {
ID: /#((?:[\w\u0128-\uFFFF_-]|\\.)+)/,
CLASS: /\.((?:[\w\u0128-\uFFFF_-]|\\.)+)/,
- NAME: /\[name=((?:[\w\u0128-\uFFFF_-]|\\.)+)\]/,
- ATTR: /\[((?:[\w\u0128-\uFFFF_-]|\\.)+)\s*(?:(\S{0,1}=)\s*(['"]*)(.*?)\3|
)\]/,
+ NAME: /\[name=['"]*((?:[\w\u0128-\uFFFF_-]|\\.)+)['"]*\]/,
+ ATTR: /\[((?:[\w\u0128-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|
)\]/,
TAG: /^((?:[\w\u0128-\uFFFF\*_-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child\(?(even|odd|[\dn+-]*)\)?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)\(?(\d*)\)?(?:[^-]|$)/,
@@ -1823,15 +1830,26 @@
}
},
NAME: function(match, context){
- return context.getElementsByName(match[1]);
+ return context.getElementsByName ?
context.getElementsByName(match[1]) : null;
},
TAG: function(match, context){
return context.getElementsByTagName(match[1]);
}
},
preFilter: {
- CLASS: function(match){
- return new RegExp( "(?:^|\\s)" + match[1] + "(?:\\s|$)" );
+ CLASS: function(match, curLoop, inplace, result, not){
+ match = " " + match[1].replace(/\\/g, "") + " ";
+
+ for ( var i = 0; curLoop[i]; i++ ) {
+ if ( not ^ (" " + curLoop[i].className + " ").indexOf(match) >= 0 ) {
+ if ( !inplace )
+ result.push( curLoop[i] );
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+
+ return false;
},
ID: function(match){
return match[1];
@@ -1869,9 +1887,18 @@
return match;
},
- PSEUDO: function(match){
+ PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) {
- match[3] = match[3].split(/\s*,\s*/);
+ // If we're dealing with a complex expression, or a simple one
+ if ( match[3].match(chunker).length > 1 ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+ return false;
+ }
}
return match;
@@ -2012,14 +2039,14 @@
var name = match[1], filter = Expr.filters[ name ];
if ( filter ) {
- return filter( elem, i, match, array )
+ return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || "").indexOf(match[3]) >=
0;
} else if ( name === "not" ) {