Skip to content

dispose doesnt work properly #140

Description

@Gawrion

Hi Mistic!

jQuery 3.6.0, Bootstrap 4.3.1, popper 1.14.7 Bootstrap Confirmation 4.2.1

After using dispose method on created instance its not possible to initialize new instance of confirmation. Example of bug:

<link rel="stylesheet" href="\css\bootstrap.css">
<script src="/js/jquery.js"></script>
<script src="/js/popper.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/bootstrap-confirmation.js"></script>

<button class="btn btn-default btn-sm btn-success " data-toggle="confirmation" id="btn-1">BTN1</button><br>
<button class="btn btn-default btn-sm btn-success " data-toggle="confirmation" id="btn-2">BTN2</button><br>
<button class="btn btn-default btn-sm btn-success " data-toggle="confirmation" id="btn-3">BTN3</button><br>

<script>
    confirmation();

    function confirmation() {
        let confirmOptions1 = {
            rootSelector: '[data-toggle=confirmation]',
            title: 'OPCJA 1',
        }
        let confirmOptions2 = {
            rootSelector: '[data-toggle=confirmation]',
            title: 'OPCJA 2',
        }
        // using popover works fine; using confirmation extension not working
        let confirmationInstance = $('[data-toggle=confirmation]').confirmation(confirmOptions1);

        $('#btn-1').confirmation('dispose');

        // new instance on #btn-1 after dispose works only with popover
        $('#btn-1').confirmation(confirmOptions2);
    }
</script>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions