moodle/lib/amd/build/fragment.min.js
Andrew Nicols e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00

11 lines
1.7 KiB
JavaScript

/**
* A way to call HTML fragments to be inserted as required via JavaScript.
*
* @module core/fragment
* @copyright 2016 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 3.1
*/
define("core/fragment",["jquery","core/ajax"],(function($,ajax){var processCollectedJavascript=function(js){var jsNodes=$(js),allScript="";return jsNodes.each((function(index,scriptNode){var tagName=(scriptNode=$(scriptNode)).prop("tagName");if(tagName&&"script"==tagName.toLowerCase())if(scriptNode.attr("src")){var exists=!1;$("script").each((function(index,s){return $(s).attr("src")==scriptNode.attr("src")&&(exists=!0),!exists})),exists||(allScript+=" { ",allScript+=' node = document.createElement("script"); ',allScript+=' node.type = "text/javascript"; ',allScript+=' node.src = decodeURI("'+encodeURI(scriptNode.attr("src"))+'"); ',allScript+=' document.getElementsByTagName("head")[0].appendChild(node); ',allScript+=" } ")}else allScript+=" "+scriptNode.text()})),allScript};return{loadFragment:function(component,callback,contextid,params){var promise=$.Deferred();return function(component,callback,contextid,params){var formattedparams=[];for(var index in params)formattedparams.push({name:index,value:params[index]});return ajax.call([{methodname:"core_get_fragment",args:{component:component,callback:callback,contextid:contextid,args:formattedparams}}])[0]}(component,callback,contextid,params).then((function(data){promise.resolve(data.html,processCollectedJavascript(data.javascript))})).fail((function(ex){promise.reject(ex)})),promise.promise()},processCollectedJavascript:function(js){return processCollectedJavascript(js)}}}));
//# sourceMappingURL=fragment.min.js.map