mirror of
https://github.com/iconify/iconify.git
synced 2024-11-08 06:15:24 +00:00
Default to svg mode in Safari because of blurred icons bug
This commit is contained in:
parent
288505fd44
commit
465b76e05f
@ -228,14 +228,21 @@
|
||||
></iconify-icon>
|
||||
</p>
|
||||
<p>
|
||||
Flip (8 icons):
|
||||
Flip (4 icons, repeated 3 times with different mode attribute):
|
||||
<iconify-icon inline icon="test:icon"></iconify-icon>
|
||||
<iconify-icon inline icon="test:icon" mode="svg"></iconify-icon>
|
||||
<iconify-icon inline icon="test:icon" mode="style"></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test:icon"
|
||||
flip="horizontal"
|
||||
></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test:icon"
|
||||
flip="horizontal"
|
||||
mode="svg"
|
||||
></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test:icon"
|
||||
@ -247,6 +254,12 @@
|
||||
icon="test2:icon"
|
||||
flip="vertical"
|
||||
></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test2:icon"
|
||||
flip="vertical"
|
||||
mode="svg"
|
||||
></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test2:icon"
|
||||
@ -258,6 +271,12 @@
|
||||
icon="test2:icon"
|
||||
flip="horizontal,vertical"
|
||||
></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test2:icon"
|
||||
flip="horizontal,vertical"
|
||||
mode="svg"
|
||||
></iconify-icon>
|
||||
<iconify-icon
|
||||
inline
|
||||
icon="test2:icon"
|
||||
|
@ -1,5 +1,13 @@
|
||||
import type { ActualRenderMode, IconifyRenderMode } from './types';
|
||||
|
||||
// Check for Safari
|
||||
let isBuggedSafari = false;
|
||||
try {
|
||||
isBuggedSafari = navigator.vendor.indexOf('Apple') === 0;
|
||||
} catch (err) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get render mode
|
||||
*/
|
||||
@ -12,9 +20,12 @@ export function getRenderMode(body: string, mode?: string): ActualRenderMode {
|
||||
return mode as ActualRenderMode;
|
||||
}
|
||||
|
||||
// Check for animation, use 'style' for animated icons
|
||||
// Check for animation, use 'style' for animated icons, unless browser is Safari
|
||||
// (only <a>, which should be ignored or animations start with '<a')
|
||||
if ((mode as IconifyRenderMode) !== 'style' && body.indexOf('<a') === -1) {
|
||||
if (
|
||||
(mode as IconifyRenderMode) !== 'style' &&
|
||||
(isBuggedSafari || body.indexOf('<a') === -1)
|
||||
) {
|
||||
// Render <svg>
|
||||
return 'svg';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user