From 467fb7a602e01aa4f152aeb8e7eb68f6062ecc28 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Fri, 10 Jan 2014 15:40:23 -0500 Subject: [PATCH] Safari 6 returns null for SVGUseElement.prototype.instanceRoot Add guards to the tests. --- test/js/SVGElementInstance.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/js/SVGElementInstance.js b/test/js/SVGElementInstance.js index 0dfdbb8..22156b9 100644 --- a/test/js/SVGElementInstance.js +++ b/test/js/SVGElementInstance.js @@ -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); }); @@ -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); }); @@ -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); }); @@ -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);