X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=jquery%2Fjquery.js;h=178ed0a3a1d2dde4be098351b9bbc7bda188a35d;hb=6e868bb091f14a534c898c7a47e6fecd3e403b60;hp=59375613d1f86d2d28deb1fdb29071026867b7e0;hpb=f4c67b7c5aba7fbdaf4b883b71ff9cc1b66e9af8;p=jquery.git diff --git a/jquery/jquery.js b/jquery/jquery.js index 5937561..178ed0a 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -61,8 +61,8 @@ function jQuery(a,c) { if ( m ) a = jQuery.clean( [ m[1] ] ); // Watch for when an array is passed in - this.get( a.constructor == Array || a.length && a[0].nodeType ? - // Assume that it's an array of DOM Elements + 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 @@ -1076,8 +1076,8 @@ new function() { * @type jQuery * @param String type An event type */ - trigger: function( type ) { - jQuery.event.trigger( this, type ); + trigger: function( type, data ) { + jQuery.event.trigger( type, data, this ); } }; @@ -1107,18 +1107,18 @@ new function() { 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 ); }; - } + }; } @@ -1176,19 +1176,21 @@ jQuery.extend({ }); return p == "height" ? oHeight : oWidth; - } + } else if ( p == "opacity" && jQuery.browser.msie ) + return parseFloat( jQuery.curCSS(e,"filter").replace(/[^0-9.]/,"") ) || 1; return jQuery.curCSS( e, p ); }, - curCSS: function(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) + else if (e.currentStyle) { + p = p.replace(/\-(\w)/g,function(m,c){return c.toUpperCase()}); r = e.currentStyle[p]; - else if (document.defaultView && document.defaultView.getComputedStyle) { + } else if (document.defaultView && document.defaultView.getComputedStyle) { p = p.replace(/([A-Z])/g,"-$1").toLowerCase(); var s = document.defaultView.getComputedStyle(e,""); r = s ? s.getPropertyValue(p) : null; @@ -1292,7 +1294,7 @@ jQuery.extend({ 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) @@ -1724,6 +1726,8 @@ jQuery.extend({ }, handle: function(event) { + if ( typeof jQuery == "undefined" ) return; + event = event || jQuery.event.fix( window.event ); // If no correct event was found, fail