From 900cea3123620a74c30c95fd59dfbed3609b73ed Mon Sep 17 00:00:00 2001 From: msand Date: Sun, 24 Nov 2013 17:19:45 +0200 Subject: [PATCH 1/3] Fix async loading of PaperScript to use correct scope. --- src/core/PaperScript.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 37757b01..0a64f1d2 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -315,9 +315,9 @@ paper.PaperScope.prototype.PaperScript = (function(root) { if (src) { // If we're loading from a source, request that first and // then run later. - paper.Http.request('get', src, function(code) { - evaluate(code, scope); - }); + paper.Http.request('get', src, function(scope, code) { + evaluate(code, scope); + }.bind(this, scope)); } else { // We can simply get the code form the script tag. evaluate(script.innerHTML, scope); From 3b22f185cef90f9377a125fa33b3c9bf0ccaf5a6 Mon Sep 17 00:00:00 2001 From: msand Date: Sun, 24 Nov 2013 17:26:09 +0200 Subject: [PATCH 2/3] Fix to make sure that attribute methods exists before calling. Check of hidpi attribute in canvas was crashing in Node.js, as the getAttribute method is undefined in node-canvas. --- src/core/PaperScope.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index d3a22bc2..9ac80c86 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -219,7 +219,7 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{ function handleAttribute(name) { name += 'Attribute'; return function(el, attr) { - return el[name](attr) || el[name]('data-paper-' + attr); + return el[name] && (el[name](attr) || el[name]('data-paper-' + attr)); }; } From 22a918190d29657d69fd546756b5cc702bce8ba9 Mon Sep 17 00:00:00 2001 From: msand Date: Sun, 24 Nov 2013 17:36:35 +0200 Subject: [PATCH 3/3] Fix indent. --- src/core/PaperScript.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 0a64f1d2..727fe480 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -315,9 +315,9 @@ paper.PaperScope.prototype.PaperScript = (function(root) { if (src) { // If we're loading from a source, request that first and // then run later. - paper.Http.request('get', src, function(scope, code) { - evaluate(code, scope); - }.bind(this, scope)); + paper.Http.request('get', src, function(scope, code) { + evaluate(code, scope); + }.bind(this, scope)); } else { // We can simply get the code form the script tag. evaluate(script.innerHTML, scope);