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