Removed a bunch more bytes from the total file size.

This commit is contained in:
John Resig 2007-01-14 07:17:41 +00:00
parent ed5bda3020
commit e1e631a044
2 changed files with 33 additions and 35 deletions

26
src/jquery/jquery.js vendored
View File

@ -33,7 +33,7 @@ var jQuery = function(a,c) {
// HANDLE: $(function) // HANDLE: $(function)
// Shortcut for document ready // Shortcut for document ready
// Safari reports typeof on DOM NodeLists as a function // Safari reports typeof on DOM NodeLists as a function
if ( isFunction(a) && !a.nodeType && a[0] == undefined ) if ( jQuery.isFunction(a) && !a.nodeType && a[0] == undefined )
return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a ); return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
// Handle HTML strings // Handle HTML strings
@ -548,7 +548,7 @@ jQuery.fn = jQuery.prototype = {
"textContent" : "innerText"; "textContent" : "innerText";
return e == undefined ? return e == undefined ?
jQuery.map(this, function(a){ return a[ type ]; }).join('') : jQuery.map(this, function(a){ return a[ type ]; }).join("") :
this.each(function(){ this[ type ] = e; }); this.each(function(){ this[ type ] = e; });
}, },
@ -864,7 +864,7 @@ jQuery.fn = jQuery.prototype = {
*/ */
filter: function(t) { filter: function(t) {
return this.pushStack( return this.pushStack(
isFunction( t.constructor ) && jQuery.isFunction( t ) &&
jQuery.grep(this, function(el, index){ jQuery.grep(this, function(el, index){
return t.apply(el, [index]) return t.apply(el, [index])
}) || }) ||
@ -1257,7 +1257,7 @@ jQuery.extend({
prop: function(elem, value, type){ prop: function(elem, value, type){
// Handle executable functions // Handle executable functions
if ( isFunction( value ) ) if ( jQuery.isFunction( value ) )
return value.call( elem ); return value.call( elem );
// Handle passing in a number to a CSS property // Handle passing in a number to a CSS property
@ -1281,7 +1281,7 @@ jQuery.extend({
elem.className = c ? elem.className = c ?
jQuery.grep( elem.className.split(/\s+/), function(cur){ jQuery.grep( elem.className.split(/\s+/), function(cur){
return !jQuery.className.has( c, cur ); return !jQuery.className.has( c, cur );
}).join(' ') : ""; }).join(" ") : "";
}, },
// internal only, use is(".class") // internal only, use is(".class")
@ -1348,8 +1348,8 @@ jQuery.extend({
curCSS: function(elem, prop, force) { curCSS: function(elem, prop, force) {
var ret; var ret;
if (prop == 'opacity' && jQuery.browser.msie) if (prop == "opacity" && jQuery.browser.msie)
return jQuery.attr(elem.style, 'opacity'); return jQuery.attr(elem.style, "opacity");
if (prop == "float" || prop == "cssFloat") if (prop == "float" || prop == "cssFloat")
prop = jQuery.browser.msie ? "styleFloat" : "cssFloat"; prop = jQuery.browser.msie ? "styleFloat" : "cssFloat";
@ -1367,12 +1367,12 @@ jQuery.extend({
if ( cur ) if ( cur )
ret = cur.getPropertyValue(prop); ret = cur.getPropertyValue(prop);
else if ( prop == 'display' ) else if ( prop == "display" )
ret = 'none'; ret = "none";
else else
jQuery.swap(elem, { display: 'block' }, function() { jQuery.swap(elem, { display: "block" }, function() {
var c = document.defaultView.getComputedStyle(this, ''); var c = document.defaultView.getComputedStyle(this, "");
ret = c && c.getPropertyValue(prop) || ''; ret = c && c.getPropertyValue(prop) || "";
}); });
} else if (elem.currentStyle) { } else if (elem.currentStyle) {
@ -1493,7 +1493,7 @@ jQuery.extend({
if ( value != undefined ) elem[fix[name]] = value; if ( value != undefined ) elem[fix[name]] = value;
return elem[fix[name]]; return elem[fix[name]];
} else if ( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == 'FORM' && (name == 'action' || name == 'method') ) } else if ( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == "FORM" && (name == "action" || name == "method") )
return elem.getAttributeNode(name).nodeValue; return elem.getAttributeNode(name).nodeValue;
// IE elem.getAttribute passes even for style // IE elem.getAttribute passes even for style

View File

@ -27,8 +27,8 @@ jQuery.extend({
contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0", contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0",
// Visibility // Visibility
visible: "a.type!='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'", hidden: 'a.type=="hidden"||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
// Form attributes // Form attributes
enabled: "!a.disabled", enabled: "!a.disabled",
@ -45,7 +45,7 @@ jQuery.extend({
submit: "a.type=='submit'", submit: "a.type=='submit'",
image: "a.type=='image'", image: "a.type=='image'",
reset: "a.type=='reset'", reset: "a.type=='reset'",
button: "a.type=='button'||a.nodeName=='BUTTON'", button: 'a.type=="button"||a.nodeName=="BUTTON"',
input: "/input|select|textarea|button/i.test(a.nodeName)" input: "/input|select|textarea|button/i.test(a.nodeName)"
}, },
".": "jQuery.className.has(a,m[2])", ".": "jQuery.className.has(a,m[2])",
@ -67,23 +67,23 @@ jQuery.extend({
// The regular expressions that power the parsing engine // The regular expressions that power the parsing engine
parse: [ parse: [
// Match: [@value='test'], [@foo] // Match: [@value='test'], [@foo]
"\\[ *(@)S *([!*$^=]*) *('?\"?)(.*?)\\4 *\\]", /^\[ *(@)([a-z0-9_-]*) *([!*$^=]*) *('?"?)(.*?)\4 *\]/i,
// Match: [div], [div p] // Match: [div], [div p]
"(\\[)\\s*(.*?(\\[.*?\\])?[^[]*?)\\s*\\]", /^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/,
// Match: :contains('foo') // Match: :contains('foo')
"(:)S\\(\"?'?(.*?(\\(.*?\\))?[^(]*?)\"?'?\\)", /^(:)([a-z0-9_-]*)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/i,
// Match: :even, :last-chlid // Match: :even, :last-chlid
"([:.#]*)S" /^([:.#]*)([a-z0-9_-]*)/i
], ],
token: [ token: [
"\\.\\.|/\\.\\.", "a.parentNode", /^(\/?\.\.)/, "a.parentNode",
">|/", "jQuery.sibling(a.firstChild)", /^(>|\/)/, "jQuery.sibling(a.firstChild)",
"\\+", "jQuery.nth(a,2,'nextSibling')", /^(\+)/, "jQuery.nth(a,2,'nextSibling')",
"~", function(a){ /^(~)/, function(a){
var s = jQuery.sibling(a.parentNode.firstChild); var s = jQuery.sibling(a.parentNode.firstChild);
return s.slice(0, jQuery.inArray(a,s)); return s.slice(0, jQuery.inArray(a,s));
} }
@ -166,7 +166,7 @@ jQuery.extend({
for ( var i = 0; i < jQuery.token.length; i += 2 ) { for ( var i = 0; i < jQuery.token.length; i += 2 ) {
// Attempt to match each, individual, token in // Attempt to match each, individual, token in
// the specified order // the specified order
var re = new RegExp("^(" + jQuery.token[i] + ")"); var re = jQuery.token[i];
var m = re.exec(t); var m = re.exec(t);
// If the token match was found // If the token match was found
@ -306,9 +306,7 @@ jQuery.extend({
// Look for, and replace, string-like sequences // Look for, and replace, string-like sequences
// and finally build a regexp out of it // and finally build a regexp out of it
var re = new RegExp( var re = p[i];
"^" + p[i].replace("S", "([a-z*_-][a-z0-9_-]*)"), "i" );
var m = re.exec( t ); var m = re.exec( t );
if ( m ) { if ( m ) {
@ -334,7 +332,7 @@ jQuery.extend({
var re = new RegExp("(^|\\s)" + m[2] + "(\\s|$)"); var re = new RegExp("(^|\\s)" + m[2] + "(\\s|$)");
r = jQuery.grep( r, function(e){ r = jQuery.grep( r, function(e){
return re.test(e.className || ''); return re.test(e.className || "");
}, not); }, not);
// Otherwise, find the expression to execute // Otherwise, find the expression to execute
@ -366,7 +364,7 @@ jQuery.extend({
if ( token == "." ) if ( token == "." )
add = s.className && re.test(s.className); add = s.className && re.test(s.className);
else if ( token == "#" ) else if ( token == "#" )
add = s.getAttribute('id') == name; add = s.getAttribute("id") == name;
if ( add ) if ( add )
r.push( s ); r.push( s );