X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=1c701933a66719b1db4042c72c2b02b58ed5a638;hb=b15ae79a389299cac19f59ed14efafc3e9d8ef0d;hp=3522f8c6b0fa269e8771c34d05d2b30dcc354d64;hpb=fb0dfd987c72906a9b499a4c5fd84807bff11678;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 3522f8c..1c70193 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -824,7 +824,9 @@ jQuery.fn = jQuery.prototype = { */ clone: function(deep) { return this.pushStack( jQuery.map( this, function(a){ - return a.cloneNode( deep != undefined ? deep : true ); + var a = a.cloneNode( deep != undefined ? deep : true ); + a.$events = null; // drop $events expando to avoid firing incorrect events + return a; }) ); }, @@ -1225,7 +1227,7 @@ jQuery.extend({ // This may seem like some crazy code, but trust me when I say that this // is the only cross-browser way to do this. --John isFunction: function( fn ) { - return !!fn && typeof fn != "string" && + return !!fn && typeof fn != "string" && !fn.nodeName && typeof fn[0] == "undefined" && /function/i.test( fn + "" ); }, @@ -1280,7 +1282,7 @@ jQuery.extend({ prop: function(elem, value, type, index, prop){ // Handle executable functions if ( jQuery.isFunction( value ) ) - return value.call( elem, [index] ); + value = value.call( elem, [index] ); // exclude the following css properties to add px var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; @@ -1311,6 +1313,8 @@ jQuery.extend({ // internal only, use is(".class") has: function( t, c ) { t = t.className || t; + // escape regex characters + c = c.replace(/([\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1"); return t && new RegExp("(^|\\s)" + c + "(\\s|$)").test( t ); } }, @@ -1467,10 +1471,10 @@ jQuery.extend({ arg = div.childNodes; } - if ( arg.length === 0 ) + if ( arg.length === 0 && !jQuery.nodeName(arg, "form") ) return; - if ( arg[0] == undefined || (jQuery.browser.msie && jQuery.nodeName(arg,"form")) ) + if ( arg[0] == undefined || jQuery.nodeName(arg, "form") ) r.push( arg ); else r = jQuery.merge( r, arg ); @@ -1525,7 +1529,7 @@ jQuery.extend({ // IE elem.getAttribute passes even for style else if ( elem.tagName ) { if ( value != undefined ) elem.setAttribute( name, value ); - if ( jQuery.browser.msie && !jQuery.isXMLDoc(elem) && /^(href|src|background|cite|classid|codebase|data|longdesc|profile|usemap)$/.test(name) ) + if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) return elem.getAttribute( name, 2 ); return elem.getAttribute( name );