X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=cf9459d248c4ce19de610114e2a4eb90a33c6ba6;hb=0f7c89cd97de6ca644a834a119dda1e057fd724e;hp=48740377ce0c991a39a81f318ee57ec8a433f986;hpb=9791855ea91988e9ff02063e0c5ece759d8ba898;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 4874037..cf9459d 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -614,10 +614,13 @@ jQuery.fn = jQuery.prototype = { */ wrap: function() { // The elements to wrap the target around - var a = jQuery.clean(arguments); + var a, args = arguments; // Wrap each of the matched elements individually return this.each(function(){ + if ( !a ) + a = jQuery.clean(args, this.ownerDocument); + // Clone the structure that we're using to wrap var b = a[0].cloneNode(true); @@ -1121,12 +1124,15 @@ jQuery.fn = jQuery.prototype = { * @cat Core */ domManip: function(args, table, dir, fn){ - var clone = this.length > 1; - var a = jQuery.clean(args); - if ( dir < 0 ) - a.reverse(); + var clone = this.length > 1, a; return this.each(function(){ + if ( !a ) { + a = jQuery.clean(args, this.ownerDocument); + if ( dir < 0 ) + a.reverse(); + } + var obj = this; if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") ) @@ -1255,7 +1261,7 @@ jQuery.extend({ // is the only cross-browser way to do this. --John isFunction: function( fn ) { return !!fn && typeof fn != "string" && !fn.nodeName && - typeof fn[0] == "undefined" && /function/i.test( fn + "" ); + fn.constructor != Array && /function/i.test( fn + "" ); }, // check if an element is in a XML document @@ -1402,12 +1408,14 @@ jQuery.extend({ curCSS: function(elem, prop, force) { var ret; + + if (prop == "opacity" && jQuery.browser.msie) { + ret = jQuery.attr(elem.style, "opacity"); + return ret == "" ? "1" : ret; + } - if (prop == "opacity" && jQuery.browser.msie) - return jQuery.attr(elem.style, "opacity"); - if (prop == "float" || prop == "cssFloat") - prop = jQuery.browser.msie ? "styleFloat" : "cssFloat"; + prop = jQuery.browser.msie ? "styleFloat" : "cssFloat"; if (!force && elem.style[prop]) ret = elem.style[prop]; @@ -1431,17 +1439,16 @@ jQuery.extend({ }); } else if (elem.currentStyle) { - var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();}); ret = elem.currentStyle[prop] || elem.currentStyle[newProp]; - } return ret; }, - clean: function(a) { + clean: function(a, doc) { var r = []; + doc = doc || document; jQuery.each( a, function(i,arg){ if ( !arg ) return; @@ -1452,7 +1459,7 @@ jQuery.extend({ // Convert html string into DOM nodes if ( typeof arg == "string" ) { // Trim whitespace, otherwise indexOf won't work as expected - var s = jQuery.trim(arg), div = document.createElement("div"), tb = []; + var s = jQuery.trim(arg), div = doc.createElement("div"), tb = []; var wrap = // option or optgroup @@ -1495,9 +1502,7 @@ jQuery.extend({ } - arg = []; - for (var i=0, l=div.childNodes.length; i