Select2 will now automatically update the selection if there are options added to or removed from the DOM within the `<select>` element. This is supported in all browsers except for Internet Explorer 8. Internet Explorer 8 does not support the DOM mutation events which were added in Internet Explorer 9, and it does not support mutation observers which are the recommended way of handling this in modern browsers. DOM mutation events also trigger for the `<select>` itself when it is pulled from the DOM, so we need to filter these out within the event handler. Despite supporting mutation observers, we cannot accurately detect if the removed option was selected at one time or another, so we need to always re-pull the selection when an element is deleted. This closes https://github.com/select2/select2/issues/4248 This builds upon https://github.com/select2/select2/pull/4249 |
||
---|---|---|
.. | ||
js | ||
scss |