Skip to content

Commit b80ba6f

Browse files
committed
Add support for canvas attribute in paperscript tags.
1 parent fdd488b commit b80ba6f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/util/PaperScript.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ var PaperScript = new function() {
144144
for (var i = 0, l = scripts.length; i < l; i++) {
145145
var script = scripts[i];
146146
if (script.type === 'text/paperscript') {
147+
// If a canvas id is provided, create a document for it now, so
148+
// the active document is defined.
149+
var canvas = script.getAttribute('canvas');
150+
if (canvas && (canvas = document.getElementById(canvas))) {
151+
new Document(canvas);
152+
}
147153
if (script.src) {
148154
load(script.src);
149155
} else {

0 commit comments

Comments
 (0)