// checked="checked" or checked (html5)
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
raction = /\=([^="'>\s]+\/)>/g,
+ rbodystart = /^\s*<body/i,
+ rbodyend = /<\/body>\s*$/i,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
// the name attribute on an input).
var html = this.outerHTML,
ownerDocument = this.ownerDocument;
-
if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
+ } else if ( rbodystart.test(html) && rbodyend.test(html) ) {
+ html = html.replace( rbodystart, "<div>" ).replace( rbodyend, "</div>" );
}
return jQuery.clean([html.replace(rinlinejQuery, "")
});
test("clone()", function() {
- expect(31);
+ expect(32);
equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' );
var clone = jQuery('#yahoo').clone();
equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' );
form.appendChild( div );
equals( jQuery(form).clone().children().length, 1, "Make sure we just get the form back." );
+
+ equal( jQuery("body").clone().children()[0].id, "qunit-header", "Make sure cloning body works" );
});
if (!isLocal) {