jonathantneal / svg4everybody

Use external SVG spritemaps today
https://jonneal.dev/svg4everybody/
Other
3.29k stars 353 forks source link

Consider using Feature Detection over browser sniffing #65

Open keithamus opened 9 years ago

keithamus commented 9 years ago

With Microsoft Edge out, svg4everybody 1.0 does not polyfill Edge properly, because it uses UA sniffing.

I've seen that 2.0 now sniffs for edge too, but ultimately it could be better (if seemingly tricky) to use feature detection to see if SVG's <use xlink:href> is supported.

Here's some things that I've tried so far, that haven't been too successful:

I realise this isn't much help, but I just wanted to open the conversation and show some of my working to save time in the hunt for the right feature detection test.

jonathantneal commented 9 years ago

This is a great conversation to have. We’ve been searching for a feature detection solution since we started this project. I’ll leave this ticket open for some time in case a new answer reveals itself.

keithamus commented 9 years ago

It'd be quite nice if, in the interim, I could manually fire the polyfill script and it wasn't guarded by the UA sniff. i.e. if I require it, it UA sniffs and automatically runs, but it returns a function which lets me manually call to run the polyfill when I'm sure I'll need it.

jonathantneal commented 9 years ago

That is primary feature in 2.0 which is set to be released today. #62

shawnbot commented 8 years ago

@jonathantneal, is this good to close then?