5 "../manipulation/buildFragment"
6 ], function( jQuery, document, rsingleTag, buildFragment ) {
8 // Argument "data" should be string of html
9 // context (optional): If specified, the fragment will be created in this context,
10 // defaults to document
11 // keepScripts (optional): If true, will include scripts passed in the html string
12 jQuery.parseHTML = function( data, context, keepScripts ) {
13 if ( !data || typeof data !== "string" ) {
16 if ( typeof context === "boolean" ) {
17 keepScripts = context;
20 context = context || document;
22 var parsed = rsingleTag.exec( data ),
23 scripts = !keepScripts && [];
27 return [ context.createElement( parsed[ 1 ] ) ];
30 parsed = buildFragment( [ data ], context, scripts );
32 if ( scripts && scripts.length ) {
33 jQuery( scripts ).remove();
36 return jQuery.merge( [], parsed.childNodes );
39 return jQuery.parseHTML;