summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2017-05-12 06:26:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-05-12 06:26:03 +0000
commit5c9ea3e40e3a5dd25024ac1851caff800d93ae94 (patch)
treedd555075d89cb66ad4ccf961eecc77352a6b03a4 /utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js
parent302090eef8ae1ffbaf0d702821980b636f8464ff (diff)
parentf562c31e824f573d9a3254a1eacb4981b29290eb (diff)
Merge "add web portal framework for TestAPI"
Diffstat (limited to 'utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js')
-rw-r--r--utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js b/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js
new file mode 100644
index 000000000..21ff6bfa7
--- /dev/null
+++ b/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js
@@ -0,0 +1,65 @@
+define( [
+ "../core",
+ "../var/document",
+ "./var/rsingleTag",
+ "../manipulation/buildFragment",
+
+ // 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
+// keepScripts (optional): If true, will include scripts passed in the html string
+jQuery.parseHTML = function( data, context, keepScripts ) {
+ if ( typeof data !== "string" ) {
+ return [];
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+
+ var base, parsed, scripts;
+
+ 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 ] ) ];
+ }
+
+ parsed = buildFragment( [ data ], context, scripts );
+
+ if ( scripts && scripts.length ) {
+ jQuery( scripts ).remove();
+ }
+
+ return jQuery.merge( [], parsed.childNodes );
+};
+
+return jQuery.parseHTML;
+
+} );