diff options
author | Oleg <markelog@gmail.com> | 2013-01-07 18:38:21 +0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2013-01-08 02:41:15 +0000 |
commit | c9bf5c5e905ec8c4d29c61f8ddf04d8a40d8e04e (patch) | |
tree | 0855fae1b990f242a24004c3675d183072f2c0c4 /test | |
parent | 054daa20afc0e2c84e66f450b155d0253a62aedb (diff) | |
download | jquery-c9bf5c5e905ec8c4d29c61f8ddf04d8a40d8e04e.tar.gz jquery-c9bf5c5e905ec8c4d29c61f8ddf04d8a40d8e04e.zip |
Bring back jQuery.buildFragment and remove jQuery.clean
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/core.js | 10 | ||||
-rw-r--r-- | test/unit/manipulation.js | 21 |
2 files changed, 11 insertions, 20 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index db21c41cc..c0fa065e0 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1210,7 +1210,7 @@ test("jQuery.proxy", function(){ }); test("jQuery.parseHTML", function() { - expect( 13 ); + expect( 17 ); var html, nodes; @@ -1237,6 +1237,14 @@ test("jQuery.parseHTML", function() { equal( jQuery.parseHTML( "\t<div></div>" )[0].nodeValue, "\t", "Preserve leading whitespace" ); equal( jQuery.parseHTML(" <div/> ")[0].nodeType, 3, "Leading spaces are treated as text nodes (#11290)" ); + + html = jQuery.parseHTML( "<div>test div</div>" ); + + equal( html[ 0 ].parentNode.nodeType, 11, "parentNode should be documentFragment" ); + equal( html[ 0 ].innerHTML, "test div", "Content should be preserved" ); + + equal( jQuery.parseHTML("<span><span>").length, 1, "Incorrect html-strings should not break anything" ); + equal( jQuery.parseHTML("<td><td>")[ 1 ].parentNode.nodeType, 11, "parentNode should be documentFragment" ); }); test("jQuery.parseJSON", function(){ diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 25ca9cd5b..5d229e575 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -463,12 +463,13 @@ var testAppend = function( valueObj ) { jQuery.each( "thead tbody tfoot colgroup caption tr th td".split(" "), function( i, name ) { $table.append( valueObj( "<" + name + "/>" ) ); equal( $table.find( name ).length, 1, "Append " + name ); - ok( jQuery.clean( ["<" + name + "/>"] ).length, name + " wrapped correctly" ); + ok( jQuery.parseHTML( "<" + name + "/>" ).length, name + " wrapped correctly" ); }); jQuery("#table colgroup").append( valueObj("<col/>") ); equal( jQuery("#table colgroup col").length, 1, "Append col" ); + jQuery("#form") .append( valueObj("<select id='appendSelect1'></select>") ) .append( valueObj("<select id='appendSelect2'><option>Test</option></select>") ); @@ -641,24 +642,6 @@ test( "append HTML5 sectioning elements (Bug #6485)", function() { equal( aside.length, 1, "HTML5 elements do not collapse their children" ); }); -test( "jQuery.clean, #12392", function() { - - expect( 6 ); - - var elems = jQuery.clean( [ "<div>test div</div>", "<p>test p</p>" ] ); - - ok( elems[ 0 ].parentNode == null || elems[ 0 ].parentNode.nodeType === 11, "parentNode should be documentFragment or null" ); - ok( elems[ 1 ].parentNode == null || elems[ 1 ].parentNode.nodeType === 11, "parentNode should be documentFragment or null" ); - - equal( elems[ 0 ].innerHTML, "test div", "Content should be preserved" ); - equal( elems[ 1 ].innerHTML, "test p", "Content should be preserved" ); - - equal( jQuery.clean([ "<span><span>" ]).length, 1, "Incorrect html-strings should not break anything" ); - - elems = jQuery.clean([ "<td><td>" ]); - ok( elems[ 1 ].parentNode == null || elems[ 1 ].parentNode.nodeType === 11, "parentNode should be documentFragment or null" ); -}); - if ( jQuery.css ) { test( "HTML5 Elements inherit styles from style rules (Bug #10501)", function() { |