To match last standards, see [CSS hide and seek](http://hugogiraudel.com/2016/10/13/css-hide-and-seek/) for more explanations :)
Also I removed the negative margin because of unwanted effects in some case, as seen on Bootstrap.
See #3895, and jQuery docs on `attr`:
> As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes.
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
Previously we hacked around the infinite loop between closeOnSelect and
selectOnClose by attempting to detect what event was being triggered
without knowing what event triggered it. Now we properly relay the
Select2 event and the jQuery event that triggered the select or unselect
This closes https://github.com/select2/select2/issues/4012
This will include the event type in the _type property, so it can be
accessed within the event handlers if it's not normally passed in. This
should not conflict with any existing handlers, and this should not be
considered a public property on event arguments.
This adds basic support for focusing the Select2 element by triggering
the `focus` event on the underlying <select> element. This implicitly
adds support for <label> elements, which will trigger the `focus` event
on the `<select>` if it is clicked.
This also fixes the focus issue that previously existed if Select2 was
opened while in a <label>. The focus would be transferred to the search
dropdown, and then immediately pulled away to the <select> element. This
happened because the <label> element triggers the `focus` event when a
`click` event propagates its way up, and we do not stop the propagation
of the `click` event when it is triggered on the selection.
This closes https://github.com/select2/select2/issues/2311.
This closes https://github.com/select2/select2/issues/4203.
This closes https://github.com/select2/select2/pull/4235.
Previously the tokenizer only worked when creating multiple options
at once if all of the options existed. It always worked when creating
a single option, because all of the special cases were handled by the
tagging module. When working with multiple options, the tagging
module does not kick in until after the query has been run, which
is when the tokenizer does its magic.
This fixes the issue by automatically creating the option tags that
the tagging module would normally create. It only does this if the
options do not already exist, so we don't need to worry about the
tokenizer creating duplicates of existing options.
This closes https://github.com/select2/select2/issues/3458
The error handler should not be raised if a request is aborted while
another one is sent out. This attempts to detect those cases by
handling the case where the error was raised and the request has a
status code of 0, which should either mean we're in offline mode or
the request was aborted.
This closes https://github.com/select2/select2/issues/4205
Previously the `dropdownAutoWidth` option didn't work because the
dropdown was being absolutely positioned, so setting the width to
`auto` didn't actually have an effect. This cannot be solved by
just setting the width on the container, because that is also
absolutely positioned.
This closes https://github.com/select2/select2/issues/3101
This fixes an issue that has existed since Select2 4.0.1 where the
arguments passed into each `<select>` were mutated. This no longer
mutates the arguments for each element, and instead only drops the
first argument once.
This closes https://github.com/select2/select2/issues/4245
- updated transaltions
- added translation for errorLoading
- issue fixes - compare characters length instead of message when adding terminal character
This closes https://github.com/select2/select2/pull/4208
This display the `errorLoading` translation when there is an error
during the AJAX cycle. Previously we were just throwing these errors
out, now we are actually displaying an error message.
This closes https://github.com/select2/select2/issues/3501