From: ruado1987 Date: Sun, 2 Jun 2013 06:32:48 +0000 (+0800) Subject: Fixes #13976: Garbage input should not cause error in buildFragment. Close gh-1284 X-Git-Tag: 2.0.3~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5f1aa2354aeffa787e40d44224a1b583b7c89666;p=jquery.git Fixes #13976: Garbage input should not cause error in buildFragment. Close gh-1284 --- diff --git a/src/manipulation.js b/src/manipulation.js index ccf606d29..19494ae2d 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -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 diff --git a/test/unit/core.js b/test/unit/core.js index 7770000e5..5fba3cf28 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -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("").length, 1, "Incorrect html-strings should not break anything" ); equal( jQuery.parseHTML("")[ 1 ].parentNode.nodeType, 11, "parentNode should be documentFragment for wrapMap (variable in manipulation module) elements too" ); + ok( jQuery.parseHTML("<#if>

This is a test.

<#/if>") || true, "Garbage input should not cause error" ); }); test("jQuery.parseJSON", function(){