mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-06-04 09:13:55 -04: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
src
|
@ -95,11 +95,12 @@ var DomElement = new function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
getStyles: function(el) {
|
getStyles: function(el) {
|
||||||
return el.ownerDocument.defaultView.getComputedStyle(el, '');
|
var view = el && el.ownerDocument.defaultView;
|
||||||
|
return view && view.getComputedStyle(el, '');
|
||||||
},
|
},
|
||||||
|
|
||||||
getStyle: function(el, key) {
|
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) {
|
setStyle: function(el, key, value) {
|
||||||
|
|
|
@ -444,8 +444,8 @@ new function() {
|
||||||
// SVG attributes can be set both as styles and direct node attributes,
|
// SVG attributes can be set both as styles and direct node attributes,
|
||||||
// so we need to handle both.
|
// so we need to handle both.
|
||||||
var styles = {
|
var styles = {
|
||||||
node: DomElement.getStyles(node),
|
node: DomElement.getStyles(node) || {},
|
||||||
parent: DomElement.getStyles(node.parentNode)
|
parent: DomElement.getStyles(node.parentNode) || {}
|
||||||
};
|
};
|
||||||
Base.each(attributes, function(apply, name) {
|
Base.each(attributes, function(apply, name) {
|
||||||
var value = getAttribute(node, name, styles);
|
var value = getAttribute(node, name, styles);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue