Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 467fb7a

Browse files
committed
Safari 6 returns null for SVGUseElement.prototype.instanceRoot
Add guards to the tests.
1 parent ee6d6f4 commit 467fb7a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/js/SVGElementInstance.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ suite('SVGElementInstance', function() {
5151
return;
5252

5353
var instanceRoot = getInstanceRoot();
54+
55+
// Safari 6 seems to return null here in some cases.
56+
if (!instanceRoot)
57+
return;
58+
5459
assert.instanceOf(instanceRoot, SVGElementInstance);
5560
assert.instanceOf(instanceRoot, EventTarget);
5661
});
@@ -65,6 +70,11 @@ suite('SVGElementInstance', function() {
6570
var svg = div.firstElementChild;
6671
var useElement = svg.firstElementChild.nextElementSibling;
6772
var instanceRoot = useElement.instanceRoot;
73+
74+
// Safari 6 seems to return null here in some cases.
75+
if (!instanceRoot)
76+
return;
77+
6878
assert.equal(useElement, instanceRoot.correspondingUseElement);
6979
});
7080

@@ -74,6 +84,11 @@ suite('SVGElementInstance', function() {
7484
return;
7585

7686
var instanceRoot = getInstanceRoot();
87+
88+
// Safari 6 seems to return null here in some cases.
89+
if (!instanceRoot)
90+
return;
91+
7792
assert.equal('g', instanceRoot.correspondingElement.localName);
7893
});
7994

@@ -84,6 +99,10 @@ suite('SVGElementInstance', function() {
8499

85100
var instanceRoot = getInstanceRoot();
86101

102+
// Safari 6 seems to return null here in some cases.
103+
if (!instanceRoot)
104+
return;
105+
87106
assert.equal('line', instanceRoot.firstChild.correspondingElement.localName);
88107
assert.equal('line', instanceRoot.lastChild.correspondingElement.localName);
89108

0 commit comments

Comments
 (0)