diff --git a/plugins/autoloader/prism-autoloader.js b/plugins/autoloader/prism-autoloader.js
index c1415b08c0..e5189ab7a8 100644
--- a/plugins/autoloader/prism-autoloader.js
+++ b/plugins/autoloader/prism-autoloader.js
@@ -153,6 +153,13 @@
 		"yml": "yaml"
 	}/*]*/;
 
+	/**
+	 * @typedef LangDataItem
+	 * @property {{ success?: function, error?: function }[]} callbacks
+	 * @property {boolean} [error]
+	 * @property {boolean} [loading]
+	 */
+	/** @type {Object<string, LangDataItem>} */
 	var lang_data = {};
 
 	var ignored_language = 'none';
@@ -216,11 +223,6 @@
 			lang = lang_aliases[lang];
 		}
 
-		var data = lang_data[lang];
-		if (!data) {
-			data = lang_data[lang] = {};
-		}
-
 		// Look for additional dependencies defined on the <code> or <pre> tags
 		var deps = elt.getAttribute('data-dependencies');
 		if (!deps && elt.parentNode && elt.parentNode.tagName.toLowerCase() === 'pre') {
@@ -282,20 +284,14 @@
 		var load = function () {
 			var data = lang_data[lang];
 			if (!data) {
-				data = lang_data[lang] = {};
-			}
-			if (success) {
-				if (!data.success_callbacks) {
-					data.success_callbacks = [];
-				}
-				data.success_callbacks.push(success);
-			}
-			if (error) {
-				if (!data.error_callbacks) {
-					data.error_callbacks = [];
-				}
-				data.error_callbacks.push(error);
+				data = lang_data[lang] = {
+					callbacks: []
+				};
 			}
+			data.callbacks.push({
+				success: success,
+				error: error
+			});
 
 			if (!force && Prism.languages[lang]) {
 				languageSuccess(lang);
@@ -329,10 +325,14 @@
 	 * @param {string} lang
 	 */
 	var languageSuccess = function (lang) {
-		if (lang_data[lang] && lang_data[lang].success_callbacks && lang_data[lang].success_callbacks.length) {
-			lang_data[lang].success_callbacks.forEach(function (f) {
-				f(lang);
-			});
+		if (lang_data[lang] ) {
+			var callbacks = lang_data[lang].callbacks;
+			while (callbacks.length) {
+				var callback = callbacks.shift().success;
+				if (callback) {
+					callback();
+				}
+			}
 		}
 	};
 
@@ -341,10 +341,14 @@
 	 * @param {string} lang
 	 */
 	var languageError = function (lang) {
-		if (lang_data[lang] && lang_data[lang].error_callbacks && lang_data[lang].error_callbacks.length) {
-			lang_data[lang].error_callbacks.forEach(function (f) {
-				f(lang);
-			});
+		if (lang_data[lang]) {
+			var callbacks = lang_data[lang].callbacks;
+			while (callbacks.length) {
+				var callback = callbacks.shift().error;
+				if (callback) {
+					callback();
+				}
+			}
 		}
 	};
 
diff --git a/plugins/autoloader/prism-autoloader.min.js b/plugins/autoloader/prism-autoloader.min.js
index 319b6f3459..8b32438ad1 100644
--- a/plugins/autoloader/prism-autoloader.min.js
+++ b/plugins/autoloader/prism-autoloader.min.js
@@ -1 +1 @@
-!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var i={javascript:"clike",actionscript:"javascript",arduino:"cpp",aspnet:["markup","csharp"],bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike",flow:"javascript",glsl:"clike",gml:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike"],"js-extras":"javascript",jsonp:"json",json5:"json",kotlin:"clike",less:"css",markdown:"markup","markup-templating":"markup",n4js:"javascript",nginx:"clike",objectivec:"c",opencl:"cpp",parser:"markup",php:["clike","markup-templating"],phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],qore:"clike",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",soy:"markup-templating",swift:"clike",tap:"yaml",textile:"markup",tt2:["clike","markup-templating"],twig:"markup",typescript:"javascript","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","visual-basic"],vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup",xquery:"markup"},l={html:"markup",xml:"markup",svg:"markup",mathml:"markup",js:"javascript",adoc:"asciidoc",shell:"bash",rbnf:"bnf",cs:"csharp",dotnet:"csharp",coffee:"coffeescript",jinja2:"django",dockerfile:"docker",gamemakerlanguage:"gml",hs:"haskell",tex:"latex",context:"latex",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",n4jsd:"n4js",objectpascal:"pascal",py:"python",rb:"ruby",ts:"typescript",t4:"t4-cs",vb:"visual-basic",xeoracube:"xeora",yml:"yaml"},n={},a=document.getElementsByTagName("script"),e="components/";if((a=a[a.length-1]).hasAttribute("data-autoloader-path")){var c=a.getAttribute("data-autoloader-path").trim();0<c.length&&!/^[a-z]+:\/\//i.test(a.src)&&(e=c.replace(/\/?$/,"/"))}else/[\w-]+\.js$/.test(a.src)&&(e=a.src.replace(/[\w-]+\.js$/,"components/"));var p=Prism.plugins.autoloader={languages_path:e,use_minified:!0},o=function(a,e,c){"string"==typeof a&&(a=[a]);var s=0,t=a.length,r=function(){s<t?u(a[s],function(){s++,r()},function(){c&&c(a[s])}):s===t&&e&&e(a)};r()},u=function(e,c,s){var t=0<=e.indexOf("!");e=e.replace("!","");var a=function(){var a=n[e];if(a||(a=n[e]={}),c&&(a.success_callbacks||(a.success_callbacks=[]),a.success_callbacks.push(c)),s&&(a.error_callbacks||(a.error_callbacks=[]),a.error_callbacks.push(s)),!t&&Prism.languages[e])m(e);else if(!t&&a.error)k(e);else if(t||!a.loading){a.loading=!0,function(a,e,c){var s=document.createElement("script");s.src=a,s.async=!0,s.onload=function(){document.body.removeChild(s),e&&e()},s.onerror=function(){document.body.removeChild(s),c&&c()},document.body.appendChild(s)}(function(a){return p.languages_path+"prism-"+a+(p.use_minified?".min":"")+".js"}(e),function(){a.loading=!1,m(e)},function(){a.loading=!1,a.error=!0,k(e)})}},r=i[e=l[e]||e];r&&r.length?o(r,a):a()},m=function(e){n[e]&&n[e].success_callbacks&&n[e].success_callbacks.length&&n[e].success_callbacks.forEach(function(a){a(e)})},k=function(e){n[e]&&n[e].error_callbacks&&n[e].error_callbacks.length&&n[e].error_callbacks.forEach(function(a){a(e)})};Prism.hooks.add("complete",function(a){a.element&&a.language&&!a.grammar&&"none"!==a.language&&function(a,e){a in l&&(a=l[a]);var c=n[a];c||(c=n[a]={});var s=e.getAttribute("data-dependencies");!s&&e.parentNode&&"pre"===e.parentNode.tagName.toLowerCase()&&(s=e.parentNode.getAttribute("data-dependencies")),s=s?s.split(/\s*,\s*/g):[],o(s,function(){u(a,function(){Prism.highlightElement(e)})})}(a.language,a.element)})}}();
\ No newline at end of file
+!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var r={javascript:"clike",actionscript:"javascript",arduino:"cpp",aspnet:["markup","csharp"],bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike",flow:"javascript",glsl:"clike",gml:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike"],"js-extras":"javascript",jsonp:"json",json5:"json",kotlin:"clike",less:"css",markdown:"markup","markup-templating":"markup",n4js:"javascript",nginx:"clike",objectivec:"c",opencl:"cpp",parser:"markup",php:["clike","markup-templating"],phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],qore:"clike",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",soy:"markup-templating",swift:"clike",tap:"yaml",textile:"markup",tt2:["clike","markup-templating"],twig:"markup",typescript:"javascript","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","visual-basic"],vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup",xquery:"markup"},n={html:"markup",xml:"markup",svg:"markup",mathml:"markup",js:"javascript",adoc:"asciidoc",shell:"bash",rbnf:"bnf",cs:"csharp",dotnet:"csharp",coffee:"coffeescript",jinja2:"django",dockerfile:"docker",gamemakerlanguage:"gml",hs:"haskell",tex:"latex",context:"latex",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",n4jsd:"n4js",objectpascal:"pascal",py:"python",rb:"ruby",ts:"typescript",t4:"t4-cs",vb:"visual-basic",xeoracube:"xeora",yml:"yaml"},l={},a=document.getElementsByTagName("script"),e="components/";if((a=a[a.length-1]).hasAttribute("data-autoloader-path")){var t=a.getAttribute("data-autoloader-path").trim();0<t.length&&!/^[a-z]+:\/\//i.test(a.src)&&(e=t.replace(/\/?$/,"/"))}else/[\w-]+\.js$/.test(a.src)&&(e=a.src.replace(/[\w-]+\.js$/,"components/"));var p=Prism.plugins.autoloader={languages_path:e,use_minified:!0},o=function(a,e,t){"string"==typeof a&&(a=[a]);var s=0,i=a.length,c=function(){s<i?m(a[s],function(){s++,c()},function(){t&&t(a[s])}):s===i&&e&&e(a)};c()},m=function(e,t,s){var i=0<=e.indexOf("!");e=e.replace("!","");var a=function(){var a=l[e];if(a||(a=l[e]={callbacks:[]}),a.callbacks.push({success:t,error:s}),!i&&Prism.languages[e])u(e);else if(!i&&a.error)k(e);else if(i||!a.loading){a.loading=!0,function(a,e,t){var s=document.createElement("script");s.src=a,s.async=!0,s.onload=function(){document.body.removeChild(s),e&&e()},s.onerror=function(){document.body.removeChild(s),t&&t()},document.body.appendChild(s)}(function(a){return p.languages_path+"prism-"+a+(p.use_minified?".min":"")+".js"}(e),function(){a.loading=!1,u(e)},function(){a.loading=!1,a.error=!0,k(e)})}},c=r[e=n[e]||e];c&&c.length?o(c,a):a()},u=function(a){if(l[a])for(var e=l[a].callbacks;e.length;){var t=e.shift().success;t&&t()}},k=function(a){if(l[a])for(var e=l[a].callbacks;e.length;){var t=e.shift().error;t&&t()}};Prism.hooks.add("complete",function(a){a.element&&a.language&&!a.grammar&&"none"!==a.language&&function(a,e){a in n&&(a=n[a]);var t=e.getAttribute("data-dependencies");!t&&e.parentNode&&"pre"===e.parentNode.tagName.toLowerCase()&&(t=e.parentNode.getAttribute("data-dependencies")),t=t?t.split(/\s*,\s*/g):[],o(t,function(){m(a,function(){Prism.highlightElement(e)})})}(a.language,a.element)})}}();
\ No newline at end of file