From 27b7063fc44db7c5c55ed4aa385490a8cb4e121e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 21 Aug 2015 15:11:01 +0200 Subject: [PATCH] To avoid possible duplicate browser requests for PaperScript files, support the data-src attribute as well as src. Closes #749. --- src/core/PaperScript.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 4e23ee46..ba6580b0 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -456,7 +456,11 @@ Base.exports.PaperScript = (function() { // project is created for it now. var canvasId = PaperScope.getAttribute(script, 'canvas'), canvas = document.getElementById(canvasId), - src = script.src, + // To avoid possible duplicate browser requests for PaperScript + // files, support the data-src attribute as well as src: + // TODO: Consider switching from data-paper- to data- prefix + // in PaperScope.getAttribute() and use it here too: + src = script.src || script.getAttribute('data-src'), async = PaperScope.hasAttribute(script, 'async'), scopeAttribute = 'data-paper-scope'; if (!canvas)