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

Commit

Permalink
Safari 6 returns null for SVGUseElement.prototype.instanceRoot
Browse files Browse the repository at this point in the history
Add guards to the tests.
  • Loading branch information
arv committed Jan 10, 2014
1 parent ee6d6f4 commit 467fb7a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/js/SVGElementInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ suite('SVGElementInstance', function() {
return;

var instanceRoot = getInstanceRoot();

// Safari 6 seems to return null here in some cases.
if (!instanceRoot)
return;

assert.instanceOf(instanceRoot, SVGElementInstance);
assert.instanceOf(instanceRoot, EventTarget);
});
Expand All @@ -65,6 +70,11 @@ suite('SVGElementInstance', function() {
var svg = div.firstElementChild;
var useElement = svg.firstElementChild.nextElementSibling;
var instanceRoot = useElement.instanceRoot;

// Safari 6 seems to return null here in some cases.
if (!instanceRoot)
return;

assert.equal(useElement, instanceRoot.correspondingUseElement);
});

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

var instanceRoot = getInstanceRoot();

// Safari 6 seems to return null here in some cases.
if (!instanceRoot)
return;

assert.equal('g', instanceRoot.correspondingElement.localName);
});

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

var instanceRoot = getInstanceRoot();

// Safari 6 seems to return null here in some cases.
if (!instanceRoot)
return;

assert.equal('line', instanceRoot.firstChild.correspondingElement.localName);
assert.equal('line', instanceRoot.lastChild.correspondingElement.localName);

Expand Down

0 comments on commit 467fb7a

Please sign in to comment.