From 5f1aa2354aeffa787e40d44224a1b583b7c89666 Mon Sep 17 00:00:00 2001 From: ruado1987 Date: Sun, 2 Jun 2013 14:32:48 +0800 Subject: [PATCH] Fixes #13976: Garbage input should not cause error in buildFragment. Close gh-1284 --- src/manipulation.js | 2 +- test/unit/core.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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(){ -- 2.39.5