@@ 10564-10594 (lines=31) @@ | ||
10561 | // context (optional): If specified, the fragment will be created in this context, |
|
10562 | // defaults to document |
|
10563 | // keepScripts (optional): If true, will include scripts passed in the html string |
|
10564 | jQuery.parseHTML = function( data, context, keepScripts ) { |
|
10565 | if ( !data || typeof data !== "string" ) { |
|
10566 | return null; |
|
10567 | } |
|
10568 | if ( typeof context === "boolean" ) { |
|
10569 | keepScripts = context; |
|
10570 | context = false; |
|
10571 | } |
|
10572 | ||
10573 | // document.implementation stops scripts or inline event handlers from |
|
10574 | // being executed immediately |
|
10575 | context = context || ( support.createHTMLDocument ? |
|
10576 | document.implementation.createHTMLDocument( "" ) : |
|
10577 | document ); |
|
10578 | ||
10579 | var parsed = rsingleTag.exec( data ), |
|
10580 | scripts = !keepScripts && []; |
|
10581 | ||
10582 | // Single tag |
|
10583 | if ( parsed ) { |
|
10584 | return [ context.createElement( parsed[ 1 ] ) ]; |
|
10585 | } |
|
10586 | ||
10587 | parsed = buildFragment( [ data ], context, scripts ); |
|
10588 | ||
10589 | if ( scripts && scripts.length ) { |
|
10590 | jQuery( scripts ).remove(); |
|
10591 | } |
|
10592 | ||
10593 | return jQuery.merge( [], parsed.childNodes ); |
|
10594 | }; |
|
10595 | ||
10596 | ||
10597 | // Keep a copy of the old load method |
@@ 9372-9402 (lines=31) @@ | ||
9369 | // context (optional): If specified, the fragment will be created in this context, |
|
9370 | // defaults to document |
|
9371 | // keepScripts (optional): If true, will include scripts passed in the html string |
|
9372 | jQuery.parseHTML = function( data, context, keepScripts ) { |
|
9373 | if ( !data || typeof data !== "string" ) { |
|
9374 | return null; |
|
9375 | } |
|
9376 | if ( typeof context === "boolean" ) { |
|
9377 | keepScripts = context; |
|
9378 | context = false; |
|
9379 | } |
|
9380 | ||
9381 | // Stop scripts or inline event handlers from being executed immediately |
|
9382 | // by using document.implementation |
|
9383 | context = context || ( support.createHTMLDocument ? |
|
9384 | document.implementation.createHTMLDocument( "" ) : |
|
9385 | document ); |
|
9386 | ||
9387 | var parsed = rsingleTag.exec( data ), |
|
9388 | scripts = !keepScripts && []; |
|
9389 | ||
9390 | // Single tag |
|
9391 | if ( parsed ) { |
|
9392 | return [ context.createElement( parsed[ 1 ] ) ]; |
|
9393 | } |
|
9394 | ||
9395 | parsed = buildFragment( [ data ], context, scripts ); |
|
9396 | ||
9397 | if ( scripts && scripts.length ) { |
|
9398 | jQuery( scripts ).remove(); |
|
9399 | } |
|
9400 | ||
9401 | return jQuery.merge( [], parsed.childNodes ); |
|
9402 | }; |
|
9403 | ||
9404 | ||
9405 | // Keep a copy of the old load method |