Skip to content

Internal cache not cleared properly after destroying select2 #5912

@hdplampert

Description

@hdplampert

Property __cache from module Utils still retains DOM element from destroyed select2 instance.

Reproducible here: https://jsfiddle.net/wgnmvfbj/2/
Click on create then destroy, cache size will not go back to 0.

I've tracked down the issue to the following line adding to cache an item that is never removed:

Utils.StoreData($container[0], 'element', this.$element);

I didn't find any reason for caching $container, so I assume the fix could be simply removing that line.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions