Changeset 4513
- Timestamp:
- 01/23/08 03:54:23 (6 months ago)
- Location:
- trunk/jquery
- Files:
-
- 2 modified
-
src/core.js (modified) (1 diff)
-
test/unit/core.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jquery/src/core.js
r4453 r4513 304 304 // the name attribute on an input). 305 305 var clone = this.cloneNode(true), 306 container = document.createElement("div"), 307 container2 = document.createElement("div"); 306 container = document.createElement("div"); 308 307 container.appendChild(clone); 309 container2.innerHTML = container.innerHTML; 310 return container2.firstChild; 308 return jQuery.clean([container.innerHTML])[0]; 311 309 } else 312 310 return this.cloneNode(true); -
trunk/jquery/test/unit/core.js
r4449 r4513 956 956 957 957 test("clone()", function() { 958 expect( 4);958 expect(20); 959 959 ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Assert text for #en' ); 960 960 var clone = $('#yahoo').clone(); 961 961 ok( 'Try them out:Yahoo' == $('#first').append(clone).text(), 'Check for clone' ); 962 962 ok( 'This is a normal link: Yahoo' == $('#en').text(), 'Reassert text for #en' ); 963 964 var cloneTags = [ 965 "<table/>", "<tr/>", "<td/>", "<div/>", 966 "<button/>", "<ul/>", "<ol/>", "<li/>", 967 "<input type='checkbox' />", "<select/>", "<option/>", "<textarea/>", 968 "<tbody/>", "<thead/>", "<tfoot/>", "<iframe/>" 969 ]; 970 for (var i = 0; i < cloneTags.length; i++) { 971 var j = $(cloneTags[i]); 972 equals( j[0].tagName, j.clone()[0].tagName, 'Clone a <' + cloneTags[i].substring(1)); 973 } 974 963 975 // using contents will get comments regular, text, and comment nodes 964 976 var cl = $("#nonnodes").contents().clone();