scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 124  →  ?path2? @ 125
/bower_components/jquery/src/core/parseHTML.js
@@ -1,57 +1,31 @@
define( [
define([
"../core",
"../var/document",
"./var/rsingleTag",
"../manipulation/buildFragment",
"../manipulation" // buildFragment
], function( jQuery, rsingleTag ) {
 
// This is the only module that needs core/support
"./support"
], function( jQuery, document, rsingleTag, buildFragment, support ) {
 
"use strict";
 
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( typeof data !== "string" ) {
return [];
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
 
var base, parsed, scripts;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
 
if ( !context ) {
 
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
if ( support.createHTMLDocument ) {
context = document.implementation.createHTMLDocument( "" );
 
// Set the base href for the created document
// so any parsed elements with URLs
// are based on the document's URL (gh-2965)
base = context.createElement( "base" );
base.href = document.location.href;
context.head.appendChild( base );
} else {
context = document;
}
}
 
parsed = rsingleTag.exec( data );
scripts = !keepScripts && [];
 
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[ 1 ] ) ];
return [ context.createElement( parsed[1] ) ];
}
 
parsed = buildFragment( [ data ], context, scripts );
parsed = jQuery.buildFragment( [ data ], context, scripts );
 
if ( scripts && scripts.length ) {
jQuery( scripts ).remove();
@@ -62,4 +36,4 @@
 
return jQuery.parseHTML;
 
} );
});