From d12b83f8d0127236725676c5804aaab65212ad86 Mon Sep 17 00:00:00 2001 From: Junle Li Date: Mon, 9 Jun 2014 21:28:09 +0800 Subject: [PATCH] Fix jQuery.parseHTML does not recognize document Fix #2307. --- jquery/jquery-tests.ts | 3 +++ jquery/jquery.d.ts | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 81ddb3ae1..79dda3e54 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -3114,6 +3114,9 @@ function test_parseHTML() { $( "
    " ) .append( nodeNames.join( "" ) ) .appendTo( $log ); + + // parse HTML with all parameters + $.parseHTML( str, document, true ); } // http://api.jquery.com/jQuery.parseJSON/ diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 70a9532ab..d6a6a792e 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -1252,6 +1252,15 @@ interface JQueryStatic { * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string */ parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; } /**