From 113ae58de80d8d843181f49d5a3d4f02a2128bac Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 11 Mar 2013 15:44:19 -0700 Subject: [PATCH] Fix up tests --- js/id/svg/surface.js | 9 +++++++-- test/index.html | 3 --- test/index_packaged.html | 3 --- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/js/id/svg/surface.js b/js/id/svg/surface.js index 44f8a9866..3dde953bc 100644 --- a/js/id/svg/surface.js +++ b/js/id/svg/surface.js @@ -1,14 +1,19 @@ iD.svg.Surface = function() { function findStylesheet(name) { return _.find(document.styleSheets, function(stylesheet) { - return stylesheet.href.indexOf(name) > 0; + return stylesheet.href && stylesheet.href.indexOf(name) > 0; }); } function sprites(stylesheetName, selectorRegexp) { var sprites = []; - _.forEach(findStylesheet(stylesheetName).cssRules, function(rule) { + var stylesheet = findStylesheet(stylesheetName); + if (!stylesheet) { + return sprites; + } + + _.forEach(stylesheet.cssRules, function(rule) { var klass = rule.selectorText, match = klass && klass.match(selectorRegexp); if (match) { diff --git a/test/index.html b/test/index.html index a58130b27..6405d8280 100644 --- a/test/index.html +++ b/test/index.html @@ -4,8 +4,6 @@ Mocha Tests - -
@@ -25,7 +23,6 @@ - diff --git a/test/index_packaged.html b/test/index_packaged.html index 29a17a4f6..24df9f978 100644 --- a/test/index_packaged.html +++ b/test/index_packaged.html @@ -4,8 +4,6 @@ Mocha Tests - -
@@ -23,7 +21,6 @@ -