]> source.dussan.org Git - jquery.git/commitdiff
Fixes #13976: Garbage input should not cause error in buildFragment. Close gh-1284
authorruado1987 <ruado1987@gmail.com>
Sun, 2 Jun 2013 06:32:48 +0000 (14:32 +0800)
committerOleg <markelog@gmail.com>
Mon, 1 Jul 2013 18:31:01 +0000 (22:31 +0400)
src/manipulation.js
test/unit/core.js

index ccf606d29e9c44eb0c07b48dda373e7dd2307c66..19494ae2dd7c734d999fd6944008824c67c851e6 100644 (file)
@@ -379,7 +379,7 @@ jQuery.extend({
                                        // Descend through wrappers to the right content
                                        j = wrap[ 0 ];
                                        while ( j-- ) {
-                                               tmp = tmp.firstChild;
+                                               tmp = tmp.lastChild;
                                        }
 
                                        // Support: QtWebKit
index 7770000e5288346ad99d9923a6096022095f143e..5fba3cf2821f3a69a31df48791feb39cd138ef1f 100644 (file)
@@ -1272,7 +1272,7 @@ test("jQuery.proxy", function(){
 });
 
 test("jQuery.parseHTML", function() {
-       expect( 17 );
+       expect( 18 );
 
        var html, nodes;
 
@@ -1308,6 +1308,7 @@ test("jQuery.parseHTML", function() {
        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 for wrapMap (variable in manipulation module) elements too" );
+       ok( jQuery.parseHTML("<#if><tr><p>This is a test.</p></tr><#/if>") || true, "Garbage input should not cause error" );
 });
 
 test("jQuery.parseJSON", function(){