-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
31 lines (26 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*! FF-SVG-path-pushState-workaround - v1.0.2 - 2016-10-29
* http://NeXTs.github.com/ff-svg-path-pushstate-workaround/
* Copyright (c) 2016 Denis Lukov; Licensed MIT */
/**
* FF SVG patterns path issue workaround
* https://bugzilla.mozilla.org/show_bug.cgi?id=652991
*
* May be deleted once FF releases v51
*/
;(function(name, definition) {
if (typeof module != 'undefined') module.exports = definition()
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
else this[name] = definition()
}('ffSvgPathPushstateWorkaround', function() {
var isFirefox = /firefox/i.test(navigator.userAgent), ffVersion
if(isFirefox) ffVersion = parseInt(navigator.userAgent.split('/').pop())
return function(selector) {
if( ! isFirefox || ffVersion >= 51) return
var patterns = document.querySelectorAll(selector || '[fill^="url(#"], [stroke^="url(#"]')
for(var i = 0, ii = patterns.length, pattern; i < ii; i++) {
pattern = patterns[i]
pattern.style.fill = pattern.style.fill
pattern.style.stroke = pattern.style.stroke
}
}
}));