// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
- var html = this.outerHTML;
+ var html = this.outerHTML, ownerDocument = this.ownerDocument;
if ( !html ) {
- var div = this.ownerDocument.createElement("div");
+ var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
- return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
+ return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")], ownerDocument)[0];
} else
return this.cloneNode(true);
});
if ( name in elem && notxml && !special ) {
if ( set ){
// We can't allow the type property to be changed (since it causes problems in IE)
- if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
+ if ( name == "type" && elem.nodeName.match(/(button|input)/i) && elem.parentNode )
throw "type property can't be changed";
elem[ name ] = value;