mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Fix issue with SVG tests.
Should really look closer at what's going on there.
This commit is contained in:
parent
7405858f32
commit
b79e32194c
2 changed files with 5 additions and 4 deletions
|
@ -95,11 +95,12 @@ var DomElement = new function() {
|
|||
},
|
||||
|
||||
getStyles: function(el) {
|
||||
return el.ownerDocument.defaultView.getComputedStyle(el, '');
|
||||
var view = el && el.ownerDocument.defaultView;
|
||||
return view && view.getComputedStyle(el, '');
|
||||
},
|
||||
|
||||
getStyle: function(el, key) {
|
||||
return el.style[key] || this.getStyles(el)[key] || null;
|
||||
return el && el.style[key] || this.getStyles(el)[key] || null;
|
||||
},
|
||||
|
||||
setStyle: function(el, key, value) {
|
||||
|
|
|
@ -444,8 +444,8 @@ new function() {
|
|||
// SVG attributes can be set both as styles and direct node attributes,
|
||||
// so we need to handle both.
|
||||
var styles = {
|
||||
node: DomElement.getStyles(node),
|
||||
parent: DomElement.getStyles(node.parentNode)
|
||||
node: DomElement.getStyles(node) || {},
|
||||
parent: DomElement.getStyles(node.parentNode) || {}
|
||||
};
|
||||
Base.each(attributes, function(apply, name) {
|
||||
var value = getAttribute(node, name, styles);
|
||||
|
|
Loading…
Reference in a new issue