4 "../manipulation" // buildFragment
5 ], function( jQuery, rsingleTag ) {
7 // data: string of html
8 // context (optional): If specified, the fragment will be created in this context, defaults to document
9 // keepScripts (optional): If true, will include scripts passed in the html string
10 jQuery.parseHTML = function( data, context, keepScripts ) {
11 if ( !data || typeof data !== "string" ) {
14 if ( typeof context === "boolean" ) {
15 keepScripts = context;
18 context = context || document;
20 var parsed = rsingleTag.exec( data ),
21 scripts = !keepScripts && [];
25 return [ context.createElement( parsed[1] ) ];
28 parsed = jQuery.buildFragment( [ data ], context, scripts );
30 if ( scripts && scripts.length ) {
31 jQuery( scripts ).remove();
34 return jQuery.merge( [], parsed.childNodes );
37 return jQuery.parseHTML;