X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=jquery%2Fjquery.js;h=0afafc5acc873793f0384f7ad093e1b563947940;hb=9b6df19cc4dcc03760aee8a6df95a0d3c8585780;hp=c24e7949ea5887b469a2b42520d6ac91e4f606b7;hpb=f197c7469f43c02bcbc65f2f41e2b419f0379700;p=jquery.git diff --git a/jquery/jquery.js b/jquery/jquery.js index c24e794..0afafc5 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -291,7 +291,15 @@ jQuery.fn = jQuery.prototype = { }, filter: function(t) { - return this.pushStack( jQuery.filter(t,this.cur).r ); + if ( /,/.test(t) ) { + var p = t.split(/\s*,\s*/); + return this.pushStack( $.map(this.cur,function(a){ + for ( var i = 0; i < p.length; i++ ) + if ( jQuery.filter(p[i],[a]).r.length ) + return a; + }) ); + } else + return this.pushStack( jQuery.filter(t,this.cur).r ); }, not: function(t) { return this.pushStack( t.constructor == String ? @@ -372,42 +380,39 @@ jQuery.className = { jQuery.boxModel = ( jQuery.browser != "msie" || document.compatMode == "CSS1Compat" ); })(); +$.swap = function(e,o,f) { + for ( var i in o ) { + e.style["old"+i] = e.style[i]; + e.style[i] = o[i]; + } + f.apply( e, [] ); + for ( var i in o ) + e.style[i] = e.style["old"+i]; +}; + jQuery.css = function(e,p) { // Adapted from Prototype 1.4.0 if ( p == "height" || p == "width" ) { + var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"]; - // Handle extra width/height provided by the W3C box model - var ph = (!jQuery.boxModel ? 0 : - jQuery.css(e,"paddingTop") + jQuery.css(e,"paddingBottom") + - jQuery.css(e,"borderTopWidth") + jQuery.css(e,"borderBottomWidth")) || 0; - - var pw = (!jQuery.boxModel ? 0 : - jQuery.css(e,"paddingLeft") + jQuery.css(e,"paddingRight") + - jQuery.css(e,"borderLeftWidth") + jQuery.css(e,"borderRightWidth")) || 0; - - var oHeight, oWidth; - - if (jQuery.css(e,"display") != 'none') { - oHeight = e.offsetHeight || parseInt(e.style.height) || 0; - oWidth = e.offsetWidth || parseInt(e.style.width) || 0; - } else { - var els = e.style; - var ov = els.visibility; - var op = els.position; - var od = els.display; - els.visibility = "hidden"; - els.position = "absolute"; - els.display = ""; - oHeight = e.clientHeight || parseInt(e.style.height); - oWidth = e.clientWidth || parseInt(e.style.width); - els.display = od; - els.position = op; - els.visibility = ov; + for ( var i in d ) { + old["padding" + d[i]] = 0; + old["border" + d[i] + "Width"] = 0; } - return p == "height" ? - (oHeight - ph < 0 ? 0 : oHeight - ph) : - (oWidth - pw < 0 ? 0 : oWidth - pw); + $.swap( e, old, function() { + if (jQuery.css(e,"display") != 'none') { + oHeight = e.offsetHeight; + oWidth = e.offsetWidth; + } else + $.swap( e, { visibility: 'hidden', position: 'absolute', display: '' }, + function(){ + oHeight = e.clientHeight; + oWidth = e.clientWidth; + }); + }); + + return p == "height" ? oHeight : oWidth; } var r; @@ -422,7 +427,7 @@ jQuery.css = function(e,p) { r = s ? s.getPropertyValue(p) : null; } - return /top|right|left|bottom/i.test(p) ? parseFloat( r ) : r; + return r; }; jQuery.clean = function(a) {