Core: use document.implemenation.createHTMLDocument in jQuery.parseHTML

Close gh-1505
This commit is contained in:
Frederic Hemberger
2014-12-09 15:13:46 -05:00
committed by Timmy Willison
parent 43faf6d1f9
commit 58c2460821
5 changed files with 39 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ define([
"../core",
"./var/rsingleTag",
"../manipulation" // buildFragment
], function( jQuery, rsingleTag ) {
], function( jQuery, rsingleTag, support ) {
// data: string of html
// context (optional): If specified, the fragment will be created in this context,
@@ -16,7 +16,11 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
keepScripts = context;
context = false;
}
context = context || document;
// document.implementation stops scripts or inline event handlers from
// being executed immediately
context = context || ( support.createHTMLDocument ?
document.implementation.createHTMLDocument() :
document );
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];