Giter Site home page Giter Site logo

Support for IE11 about reactshadow HOT 4 CLOSED

wildhoney avatar wildhoney commented on August 19, 2024
Support for IE11

from reactshadow.

Comments (4)

aliblackwell avatar aliblackwell commented on August 19, 2024

Hi @dcapilla, I had the same issue. Fixed it by npm installing [email protected]. Version 17 uses a Proxy which isn't supported by IE11. I messed around for ages trying to polyfill Proxy and then realised I could just use an older version.

Finally, rather than attempt to polyfill Shadow Dom for IE11, I ended up with the following wrapper component that detects support for attachShadow and only serves the ShadowDOM component if it's there:

import React from 'react';
import ShadowDOM from 'react-shadow';

function ShadowDomFactory(props) {
    function shouldUseShadowDom() {
        return typeof document.body.attachShadow === 'function';
    }

    return (
        <>
            {shouldUseShadowDom() ? (
                <ShadowDOM>{props.children}</ShadowDOM>
            ) : (
                <div>{props.children}</div>
            )}
        </>
    );
}

export default ShadowDomFactory;

Hope this helps!

from reactshadow.

Wildhoney avatar Wildhoney commented on August 19, 2024

Thanks @aliblackwell

We had a pull request a while ago that added support for polyfilling Proxy.

from reactshadow.

marijnbent avatar marijnbent commented on August 19, 2024

So what is the current workflow to add compatibility for older browsers? In an older issue, backwards compatibility was added #(30), but is removed since 17?

from reactshadow.

Wildhoney avatar Wildhoney commented on August 19, 2024

Does the polyfill referenced in #30 not work any more @marijnbent? The only other thing we had in the older version was it supported an older versions of shadow boundaries (v0), which this one doesn't. The polyfill should handle that difference perfectly fine itself.

from reactshadow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.