mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
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:
parent
eb3628063c
commit
27b7063fc4
1 changed files with 5 additions and 1 deletions
|
@ -456,7 +456,11 @@ Base.exports.PaperScript = (function() {
|
||||||
// project is created for it now.
|
// project is created for it now.
|
||||||
var canvasId = PaperScope.getAttribute(script, 'canvas'),
|
var canvasId = PaperScope.getAttribute(script, 'canvas'),
|
||||||
canvas = document.getElementById(canvasId),
|
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'),
|
async = PaperScope.hasAttribute(script, 'async'),
|
||||||
scopeAttribute = 'data-paper-scope';
|
scopeAttribute = 'data-paper-scope';
|
||||||
if (!canvas)
|
if (!canvas)
|
||||||
|
|
Loading…
Reference in a new issue