X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=inline;f=src%2Fcore.js;h=6c439a5a6c449d6a8a2b91b1bb31aa3895aee523;hb=0c97178553606c01b999441836e23f9f36c645a3;hp=fe5dbc6bf053b91764b2c5fbcf8a042a590dfb9d;hpb=c6f189ac73939c813bf3a2b848c492c8ba259807;p=jquery.git diff --git a/src/core.js b/src/core.js index fe5dbc6..6c439a5 100644 --- a/src/core.js +++ b/src/core.js @@ -266,6 +266,8 @@ jQuery.fn = jQuery.prototype = { return this.prevObject || jQuery( [] ); }, + // For internal use only. + // Behaves like an Array's .push method, not like a jQuery method. push: [].push, find: function( selector ) { @@ -342,10 +344,12 @@ jQuery.fn = jQuery.prototype = { }, closest: function( selector ) { + var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null; + return this.map(function(){ var cur = this; while ( cur && cur.ownerDocument ) { - if ( jQuery(cur).is(selector) ) + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) return cur; cur = cur.parentNode; } @@ -921,8 +925,8 @@ jQuery.extend({ if ( fragment ) { for ( var i = 0; ret[i]; i++ ) { - if ( jQuery.nodeName( ret[i], "script" ) ) { - scripts.push( ret[i].parentNode.removeChild( ret[i] ) ); + if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { + scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); } else { if ( ret[i].nodeType === 1 ) ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); @@ -957,7 +961,7 @@ jQuery.extend({ // Safari mis-reports the default selected property of a hidden option // Accessing the parent's selectedIndex property fixes it - if ( name == "selected" ) + if ( name == "selected" && elem.parentNode ) elem.parentNode.selectedIndex; // If applicable, access the attribute via the DOM 0 way @@ -1144,9 +1148,6 @@ jQuery.browser = { mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) }; -// Check to see if the W3C box model is being used -jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat"; - jQuery.each({ parent: function(elem){return elem.parentNode;}, parents: function(elem){return jQuery.dir(elem,"parentNode");},