From 87a1ff15fdf7584e67e0fa9cc9d8780ac7435a5a Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 19 Jul 2017 10:25:13 +0900 Subject: [PATCH] Treat URL as loaded when loading script with tag. --- app/assets/javascripts/discourse/lib/load-script.js.es6 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/load-script.js.es6 b/app/assets/javascripts/discourse/lib/load-script.js.es6 index ab67a3a880a..d40b17c6639 100644 --- a/app/assets/javascripts/discourse/lib/load-script.js.es6 +++ b/app/assets/javascripts/discourse/lib/load-script.js.es6 @@ -38,9 +38,9 @@ export default function loadScript(url, opts) { $('script').each((i, tag) => { const src = tag.getAttribute('src'); - // For some reason, a script tag with `url` as the source is appended into - // the head tag while loading the script. - if (src && src !== url) _loaded[tag.getAttribute('src')] = true; + if (src && (opts.scriptTag || src !== url)) { + _loaded[tag.getAttribute('src')] = true; + } });