Skip to content

Commit e2c4b1c

Browse files
committed
fix(Visualize): SVG clips now work again, fixes #272
Due to this issue angular/angular.js#8934 (comment) we were using absolute paths to reference clips. Unfortunately this stopped working as soon as we started using deep linking on the visualize page. Instead, an update to the issue means we can drop support for IE9 and remove some of the need for the `<base>` element. Fixes #272
1 parent 59a0fc1 commit e2c4b1c

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/app/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ angular.module("baw",
194194
});
195195

196196
// location config
197-
$locationProvider.html5Mode(true);
197+
// https://github.com/angular/angular.js/issues/8934#issuecomment-56568466
198+
// Now removing base tag and deprecating support for IE9
199+
$locationProvider.html5Mode({enabled: true, requireBase: false});
198200

199201
// http default configuration
200202
$httpProvider.defaults.withCredentials = true;

src/components/services/vendorServices/externals.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,18 @@ angular
115115
};
116116

117117
d3.selection.prototype.clipPath = function (clipUrl) {
118-
var funcIriRegex = /url\(#(.*)\)/;
118+
var funcUriRegex = /url\(#(.*)\)/;
119119
if (arguments.length === 1) {
120-
var match = funcIriRegex.exec(clipUrl),
120+
var match = funcUriRegex.exec(clipUrl),
121121
newUrl = clipUrl;
122122
if (match) {
123123
// angular's HTML 5 mode breaks relative links for the clip-path attribute
124124
// See: https://github.com/angular/angular.js/issues/8934
125125
// This function take a normal clip url and absolutifies it so it will work.
126-
var absoluteUrl = window.location.href;
127-
newUrl = "url(" + absoluteUrl + "#" + match[1] + ")";
126+
// UPDATE: https://github.com/angular/angular.js/issues/8934#issuecomment-56568466
127+
// Now removing base tag and deprecating support for IE9
128+
//var absoluteUrl = window.location.href;
129+
newUrl = "url(#" + match[1] + ")";
128130
}
129131
return this.attr("clip-path", newUrl);
130132
}

src/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title><%= build_configs.values.brand.title %></title>
77

8-
<base href="/">
8+
<%
9+
// https://github.com/angular/angular.js/issues/8934#issuecomment-56568466
10+
// Now removing base tag and deprecating support for IE9
11+
// <base href="/">
12+
%>
913

1014
<!-- compiled CSS -->
1115
<link rel="stylesheet" type="text/css" href="<%= build_configs.current.siteDir %><%= mainStyle %>"/>

0 commit comments

Comments
 (0)