scratch – Blame information for rev 125
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
125 | office | 1 | define([ |
58 | office | 2 | "../core", |
3 | "./var/rsingleTag", |
||
125 | office | 4 | "../manipulation" // buildFragment |
5 | ], function( jQuery, rsingleTag ) { |
||
58 | office | 6 | |
125 | office | 7 | // data: string of html |
8 | // context (optional): If specified, the fragment will be created in this context, defaults to document |
||
58 | office | 9 | // keepScripts (optional): If true, will include scripts passed in the html string |
10 | jQuery.parseHTML = function( data, context, keepScripts ) { |
||
125 | office | 11 | if ( !data || typeof data !== "string" ) { |
12 | return null; |
||
58 | office | 13 | } |
14 | if ( typeof context === "boolean" ) { |
||
15 | keepScripts = context; |
||
16 | context = false; |
||
17 | } |
||
125 | office | 18 | context = context || document; |
58 | office | 19 | |
125 | office | 20 | var parsed = rsingleTag.exec( data ), |
21 | scripts = !keepScripts && []; |
||
58 | office | 22 | |
23 | // Single tag |
||
24 | if ( parsed ) { |
||
125 | office | 25 | return [ context.createElement( parsed[1] ) ]; |
58 | office | 26 | } |
27 | |||
125 | office | 28 | parsed = jQuery.buildFragment( [ data ], context, scripts ); |
58 | office | 29 | |
30 | if ( scripts && scripts.length ) { |
||
31 | jQuery( scripts ).remove(); |
||
32 | } |
||
33 | |||
34 | return jQuery.merge( [], parsed.childNodes ); |
||
35 | }; |
||
36 | |||
37 | return jQuery.parseHTML; |
||
38 | |||
125 | office | 39 | }); |