mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Core: use document.implemenation.createHTMLDocument in jQuery.parseHTML
Close gh-1505
This commit is contained in:
committed by
Timmy Willison
parent
43faf6d1f9
commit
58c2460821
@@ -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 && [];
|
||||
|
||||
Reference in New Issue
Block a user