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.

This commit is contained in:
msand 2013-11-24 17:26:09 +02:00
parent 900cea3123
commit 3b22f185ce

View file

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