Fix issue with SVG tests.

Should really look closer at what's going on there.
This commit is contained in:
Jürg Lehni 2013-03-01 14:17:31 -08:00
parent 7405858f32
commit b79e32194c
2 changed files with 5 additions and 4 deletions

View file

@ -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) {

View file

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