flashjs icon indicating copy to clipboard operation
flashjs copied to clipboard

Failed to execute 'removeChild' on 'Node' -> Fix

Open SjoerdHekking opened this issue 2 years ago • 3 comments

Unsure if @betaWeb still maintains this, but if so:

When clicking on a flash message, this causes the next error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. Even on the demo/example site.

To fix this, we want to turn removeChild() into remove() so we can properly target all children of the flash container.

I could make a pull request for merging if you'd like? (or fork it anyway?)

SjoerdHekking avatar Jul 17 '22 10:07 SjoerdHekking

Hello @SjoerdHekking :)

You can make a PR if you want, thanks :)

betaWeb avatar Jul 18 '22 08:07 betaWeb

Send a pull request, you should be able to merge it without problems. Thanks.

SjoerdHekking avatar Jul 18 '22 18:07 SjoerdHekking

I'm experiencing the same issue on the code in master.zip. Any idea when this will be merged?

To work around the problem, I modified my dist/flash.min.js so that this.$_element.classList.removeChild(this.options.classes.visible) becomes this.$_element.classList.remove(this.options.classes.visible)

{
    key:"_close",
    value:function(){
        var e=this;
        this._stopProgress(),
        this._isInteractive()&&this._unbindEvents(),
        this.$_element.classList.remove(this.options.classes.visible),
        this.$_element.addEventListener(
            "transitionend",
            function(){
                e.$_container.remove(e.$_element),e._clear()
            }
        )
    }
}

patrick-melo avatar Mar 01 '23 21:03 patrick-melo