Re:Show HN: React component for blurred backgrounds
by javierbyte on Friday April 03, 2015 @04:44PM
(#9318382)
Author here. As far as I know there is no way to do blur with CSS in IE10+ https://github.com/Schepp/CSS-Filters-Polyfill#a-word-regard... so we must use canvas to be cross-browser.
Re:Show HN: React component for blurred backgrounds
by spdustin on Friday April 03, 2015 @04:59PM
(#9318477)
You can. SVG Filters are supported.
http://blogs.msdn.com/b/ie/archive/2011/10/14/svg-filter-eff...
Edit: to clarify, the image would need to be moved into the SVG (which could be a simple DOM manipulation of the original <img> tag).
Re:Show HN: React component for blurred backgrounds
by fitter on Friday April 03, 2015 @05:05PM
(#9318524)
Hm, if that's the case, then theoretically this component can be easily improved to support any DOM container (not just images) by just polyfilling filter: with native or SVG.
Re:Show HN: React component for blurred backgrounds
by spdustin on Friday April 03, 2015 @05:34PM
(#9318709)
I dunno about that. <img> has a pretty direct analog in SVG that you could create by adding it (and the SVG container) to the DOM in script. Arbitrary markup would probably be best to render into a canvas.
Of course, you could always just force IE9 mode... ;)
Re:Show HN: React component for blurred backgrounds
by javierbyte on Friday April 03, 2015 @05:03PM
(#9318510)
Thank you! I will investigate and compare.
Re:Show HN: React component for blurred backgrounds
by amelius on Friday April 03, 2015 @07:14PM
(#9319136)
But why write this as a React component, when a plain javascript implementation would do fine (in view of compatibility with existing code, which may not be using React)? Am I missing something?
Re:Show HN: React component for blurred backgrounds
by javierbyte on Saturday April 04, 2015 @01:19AM
(#9319992)
Yeah, I was also thinking in create a non-react version, but a separate react version would still be needed since we are doing DOM manipulation.
Is there some advantage I'm missing?