Blame view

bower_components/jquery/src/core/parseHTML.js 938 Bytes
c5169e0e   Renato De Donato   a new hope
1
  define([
74249687   Luigi Serra   Cross browser con...
2
  	"../core",
74249687   Luigi Serra   Cross browser con...
3
  	"./var/rsingleTag",
c5169e0e   Renato De Donato   a new hope
4
5
  	"../manipulation" // buildFragment
  ], function( jQuery, rsingleTag ) {
74249687   Luigi Serra   Cross browser con...
6
  
c5169e0e   Renato De Donato   a new hope
7
8
  // data: string of html
  // context (optional): If specified, the fragment will be created in this context, defaults to document
74249687   Luigi Serra   Cross browser con...
9
10
11
12
13
14
15
16
17
  // keepScripts (optional): If true, will include scripts passed in the html string
  jQuery.parseHTML = function( data, context, keepScripts ) {
  	if ( !data || typeof data !== "string" ) {
  		return null;
  	}
  	if ( typeof context === "boolean" ) {
  		keepScripts = context;
  		context = false;
  	}
c5169e0e   Renato De Donato   a new hope
18
  	context = context || document;
74249687   Luigi Serra   Cross browser con...
19
20
21
22
23
24
  
  	var parsed = rsingleTag.exec( data ),
  		scripts = !keepScripts && [];
  
  	// Single tag
  	if ( parsed ) {
c5169e0e   Renato De Donato   a new hope
25
  		return [ context.createElement( parsed[1] ) ];
74249687   Luigi Serra   Cross browser con...
26
27
  	}
  
c5169e0e   Renato De Donato   a new hope
28
  	parsed = jQuery.buildFragment( [ data ], context, scripts );
74249687   Luigi Serra   Cross browser con...
29
30
31
32
33
34
35
36
37
38
  
  	if ( scripts && scripts.length ) {
  		jQuery( scripts ).remove();
  	}
  
  	return jQuery.merge( [], parsed.childNodes );
  };
  
  return jQuery.parseHTML;
  
c5169e0e   Renato De Donato   a new hope
39
  });