To avoid possible duplicate browser requests for PaperScript files, support the data-src attribute as well as src.

Closes #749.
This commit is contained in:
Jürg Lehni 2015-08-21 15:11:01 +02:00
parent eb3628063c
commit 27b7063fc4

View file

@ -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)