BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.17k stars 754 forks source link

Not Compatible with OpenUI5 / DOMException: Failed to execute 'removeChild' #1597

Open promosjotte opened 6 years ago

promosjotte commented 6 years ago

Issue details

Development with OpenUI5 framework works not with BS. There is an error Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Steps to reproduce/test case

Use BS with any OpenUI5 App

Please provide necessary steps for reproduction of this issue, or better the reduced test case (without any external dependencies).

Fixed it localy in \node_modules\browser-sync\client\dist\index.js with a try/catch (line 1952):

        /**
         * Now remove the element after the given timeout
         */
        switchMap_1.switchMap(function (_a) {
            var event = _a[0], options = _a[1], element = _a[2], document = _a[3];
            return timer_1.timer(event[1] || 2000).pipe(tap_1.tap(function () {
                element.style.display = "none";             
                if (element.parentNode) {
                    //try catch is the fix
                    try
                    {
                        document.body.removeChild(element); 
                    }
                    catch(e)
                    {
                        console.log("this helps")
                    }

                }
            }));

Please specify which version of Browsersync, node and npm you're running

Affected platforms

Browsersync use-case

If CLI, please paste the entire command below

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

with gulp:

var browserSync = require("browser-sync");

browserSync({
    port: 9000,
    server: {
        baseDir: `./app`
    }
});
jonaszuberbuehler commented 5 years ago

As a workaround you could disable notifications (option notify:false).

promosjotte commented 5 years ago

@jonaszuberbuehler thanks, works! This is definitely a better workaround.