*/
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;
}) );
},
// 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 + "" );
},
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;
// 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 );
}
},
if ( arg.length === 0 )
return;
- if ( arg[0] == undefined || jQuery.nodeName(arg,"form") )
+ if ( arg[0] == undefined )
r.push( arg );
else
r = jQuery.merge( r, arg );
// IE elem.getAttribute passes even for style
else if ( elem.tagName ) {
if ( value != undefined ) elem.setAttribute( name, value );
- if ( name == "href" && jQuery.browser.msie && !jQuery.isXMLDoc(elem) ) return elem.getAttribute( name, 2 );
+ if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
+ return elem.getAttribute( name, 2 );
return elem.getAttribute( name );
// elem is actually elem.style ... set the style