1
0
mirror of synced 2024-11-22 21:16:10 +03:00
Commit Graph

2382 Commits

Author SHA1 Message Date
Vasyl Zuzyak
e3f9466d8b Reuse result of previous calcualtion
This closes https://github.com/select2/select2/pull/4155.
2016-02-14 14:03:49 -05:00
Bruno Sampaio
d976f1c576 added test for recursively applying defaults
This adds tests for 983cd8e765.
2016-02-14 14:00:01 -05:00
Bruno Sampaio
983cd8e765 Recursively apply defaults
This closes https://github.com/select2/select2/pull/4130.
2016-02-14 13:58:14 -05:00
Ben
65179f16de Santize automatically generated ids
This closes https://github.com/select2/select2/issues/3618.
This closes https://github.com/select2/select2/pull/4123.
2016-02-14 13:48:19 -05:00
Kevin Brown
75163d67cb Switched options page to use Jekyll highlighting 2016-02-14 13:33:33 -05:00
Kevin Brown
a126b53b4c CSS changes for Rouge highlighting
This adds a new CSS file and adjusts existing highlighting files for the
Rouge syntax highlighting that was enabled.
2016-01-30 21:01:12 -05:00
Kevin Brown
d5a76aab26 Switched 4.0 announcement to Jekyll highlighting 2016-01-30 18:30:57 -05:00
Kevin Brown
74387b9863 Switched examples to use Jekyll's highlighting
This fixes some bugs that were present in the old Prettify highlighter
when there was a mix of JavaScript and HTML in the same code block. Now
with Rouge, the highlighter used by Jekyll, these cases are properly
handled and HTML no longer looks strange.

This does not convert all of the code blocks over, because there are
still some code blocks which double as the actual JavaScript code
powering the example that need to be migrated.
2016-01-30 18:09:01 -05:00
Kevin Brown
54441e6a22 Switched index to use Jekyll's code highlighting
We previously used Google's Prettify, which worked on the client side.
Now that we are actually using Jekyll, and it has built-in syntax
highlighting, we might as well change to doing highlighting on the
backend.
2016-01-28 11:54:24 -05:00
Kevin Brown
ff9486bbd2 Merge pull request #4127 from drmonkeyninja/patch-1
Replaced protocol-relative URLs with HTTPS protocol
2016-01-28 11:26:00 -05:00
Andy Carter
9b4b9175fc Replaced protocol-relative URLs with HTTPS protocol
Use of protocol-relative URLs is now seen as an anti-pattern as it leaves the door open to attacks. As the CDNs serve over HTTPS it should be recommended that people use HTTPS rather than protocol-relative URLs. See Paul Irish's post on [Protocol-relative URLs](http://www.paulirish.com/2010/the-protocol-relative-url/) for more details.
2016-01-27 10:21:50 +00:00
Kevin Brown
97f7eea9ce Recompile dist 2016-01-14 19:31:16 -05:00
Kevin Brown
0840c3923f Code samples and docs for selections 2016-01-14 19:30:11 -05:00
Kevin Brown
ce2204cff0 Code samples for options affecting the dropdown
This is just code samples, most of this still needs readable (non-code)
documentation that actually explains what is going on with the options.
2016-01-14 19:29:48 -05:00
Kevin Brown
55aa2c64cc More docs for data adapters 2016-01-14 19:26:19 -05:00
Kevin Brown
d6bc96d7de Expand upon the core section of the docs
This adds more code examples where they might be useful, and adds some
more description where it was needed. This clarifies a couple of the
questions that have come up about the AMD support and links to the bug
that Select2 was involved with that some people reported when 4.0.0 was
released.
2016-01-14 18:40:37 -05:00
Kevin Brown
69ef214c92 Display error message on AJAX errors
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
2016-01-04 20:07:37 -05:00
Kevin Brown
db5e947664 Added test for new insertTag option
This adds a basic test that ensures that the `insertTag` option works as
expected.
2016-01-03 19:09:45 -05:00
Stretch
e842797aaf Added insertTag to control the tag position
This adds an option called `insertTag` that controls the location within
the results where the tag is inserted. The function should take in the
results array and the tag, and should modify the array in-place to add
the tag to the results.

This closes https://github.com/select2/select2/issues/3420
This closes https://github.com/select2/select2/pull/4008
2016-01-03 19:08:59 -05:00
Kevin Brown
63d531a9c0 Fixed responsive example in documentation
This fixes the documentation so the responsive example actually works.
Everything was working properly, the example just wasn't updated when
the default for the width was changed to `100%` in
5fd72d2052.
This is a change from the old `resolve` width setting, which is
responsible for parsing the style attribute and getting the width that
was set.

This closes https://github.com/select2/select2/issues/4050
2016-01-03 18:57:49 -05:00
Kevin Brown
f3b9693ad9 Fixed existing selections not being respected with array data
This fixes an edge case that occurred pretty much whenever anyone would
use array data with existing selections along with a placeholder. This
caused the existing selections to be discarded, because the `selected`
property was not being transferred over to the new option. This was
based the new data was being preferred over the data that could be
inferred from the option, and the new data typically did not include the
selected state. As a result, the option was assumed to not be selected.

This was not cause by existing tests because all of the existing tests
only covered cases where the selected option was the first option, and
that was not affected by this bug.
2016-01-03 18:34:59 -05:00
Kevin Brown
d1ed0a513a Add failing test for existing array selections
This adds a broken test that demonstrates the issue seen in
https://github.com/select2/select2/issues/3990 where existing selected
options are being reset once Select2 is initialized. This issue cannot
be reproduced on the options page [1] because the issue only appear to
happen if the selected option is not the first one in the list of
possible options.

[1]: https://select2.github.io/examples.html#data-array
2016-01-03 18:21:09 -05:00
Kevin Brown
f58c1efc11 Fixed failing tests in IE9/FX
This fixes the two failing assertions that only triggered in IE 9 (no
other versions) and Firefox. Both of them were caused by the offset for
the dropdown including a constant extra amount, what appeared to be
related to the size of the container if it actually had content. This
was not consistent in browsers, so now we are forcing there to be a
small amount of content within the container and then calculating the
expected offset based on that height.
2016-01-03 17:46:01 -05:00
Kevin Brown
09ecd3cdb9 Remove dead code
This call to `$.fn.position` was causing an error in IE 8 because the
`offsetParent` was null on the container for some reason. It's not
needed, so this line of code has been removed.

This should fix the test failures in IE 8.
2016-01-01 18:16:51 -05:00
Kevin Brown
e260860789 Correct positioning issues for statically positioned elements
There was a commit that landed in 4.0.1 that fixed positioning for
non-static elements, which are commonly used for the custom
`dropdownParent` option, but broke positioning for statically positioned
elements, commonly used in almost every other case. That commit was
c9216b4b96

This fixes the positioning issues caused by that commit by properly
calculating the offsets for statically positioned parents. Statically
positioned parents are unique, because the offset for the dropdown must
be calculated based on the closest element that is non-statically
positioned. Otherwise, the offset for any statically positioned parent
other than the body will be considerably higher than it should be,
resulting in the dropdown being offset by a large amount.

The offset parent for the body element is the html element, which is why
this works for both the body element and any custom parents for the
dropdown. This would not be needed if the parent wasn't customizable (as
seen in Select2 3.x) because you will never need to offset the body
element if it is statically positioned, because the html element almost
never has an offset.

This also fixes JSHint issues within the tests added in the last commit.

This closes https://github.com/select2/select2/issues/3970
This closes https://github.com/select2/select2/issues/3639
2016-01-01 17:15:00 -05:00
Kevin Brown
b5a4698250 Add regression tests for the positioning issues
This adds a regression test that verifies the problem with positioning
the dropdown when the parent is a statically positioned element that
still has an offset. This could typically be seen if the body element
has an offset, which unfortunately it almost always does because of the
default user stylesheet in browsers. This was not caught during
pre-release testing because all of the test pages reset the margins and
padding on the body element.

This regression test verifies that the offsets that should be set for
the dropdown are calculated correctly. These were surprisingly difficult
to do because of how the offset is calculated using different
positioning techniques.

These tests are for https://github.com/select2/select2/issues/3970
2016-01-01 16:47:49 -05:00
Kevin Brown
9c35475c6c Added test for attachBody
This is just a basic test that ensures that the dropdown is appended to
the end of the dropdown parent when `dropdownParent` is defined.
2015-12-31 13:04:38 -05:00
ricardokenji
c33ba3117b Update clearing-selections.html 2015-12-11 13:25:09 -02:00
Kevin Brown
bc19964170 Update version identifiers to 4.0.1 2015-11-27 18:26:20 -05:00
Kevin Brown
c9216b4b96 Fixed positioning with non-static parents
This fixes an issue with non-static parents (ones that were relatively
or absolutely positioned) where the dropdown would be offset by the
offset of the parent, so it would almost never line up. This fixes the
problem by removing the offset when the parent is not statically
positioned, which is what we used to do in older versions of Select2.

This closes https://github.com/select2/select2/issues/3303.
This closes https://github.com/select2/select2/issues/3614.
This closes https://github.com/select2/select2/issues/3672.
2015-11-27 17:58:08 -05:00
Kevin Brown
393ca4cf7f Fix selectOnBlur and closeOnSelect combination
This fixes an infinite loop that used to be caused when both
`closeOnSelect` and `selectOnClose` used to be combined, because they
both were listening to events triggered by the other one. The problem
was that `selectOnClose` was triggering `select` events for data objects
which had already been selected. This problem was solved by checking if
the data object was already selected before trying to select it again.

This closes https://github.com/select2/select2/pull/3751.
This closes https://github.com/select2/select2/issues/3169.
2015-11-27 17:32:54 -05:00
Kevin Brown
d504700c53 Recompile dist with newer dependencies 2015-11-27 16:07:10 -05:00
Kevin Brown
af97cc9996 Use NPM versions in builds
This changes the Grunt script to automatically pull the locations of the
NPM versions of the Almond loader and jQuery mousewheel plugin. This
means we no longer need to include these vendor files in our repository,
as the builds will automatically pull from the existing NPM files.
2015-11-27 16:07:08 -05:00
Kevin Brown
32b6eae54b Explicitly require jquery-mousewheel now
This fixes the implicit requirement of jquery-mousewheel that previously
existed. This was not allowed, as pointed out in
https://github.com/select2/select2/issues/3287#issuecomment-120408092

Now the requirement is more explicit, so everything should work as it
was before.
2015-11-27 16:07:07 -05:00
Kevin Brown
8edf3c6408 Add dependencies on Almond and jQuery Mousewheel
These are technically only required when building the final versions,
but if someone is pulling from NPM they may want to deal with building
it as well. Almond is used for loading in packages and jQuery Mousewheel
is used to prevent the results from scrolling the page.
2015-11-27 16:07:05 -05:00
Kevin Brown
5ca76fda61 Merge pull request #3782 from nopash/patch-1
Correct Typo in noResults
2015-11-27 15:42:51 -05:00
Kevin Brown
23743a785c Merge pull request #3933 from Decagon/patch-1
Fix #3932
2015-11-27 14:56:40 -05:00
Kevin Brown
3c8366e876 Fixed deep cloning options
In
f1e86470ca
we tried to fix the issue where multiple instances created in a single
call would share the same options, and this worked for the most common
cases. Unfortunately it did not work for the case where data attributes
were also used with an options object, and as a result data attributes
would be copied to all instances. Data attributes are supposed to be
specific to a single instance.

This was fixed by moving the `true` for the deep copy to the start of
the `$.extend` call, as this is where jQuery looks for the deep copy
flag.

This closes https://github.com/select2/select2/issues/3485
2015-11-23 18:55:31 -05:00
Kevin Brown
e2b745ea3e Recompiled dist 2015-11-23 18:44:35 -05:00
Kevin Brown
dc516e7073 Add container to templateResult
This closes https://github.com/select2/select2/issues/3222.
2015-11-23 18:40:50 -05:00
Jono Mingard
7e3d4fb697 Add tests for accessible search results 2015-11-23 18:35:36 -05:00
Jono Mingard
9fae3d74e3 Speak results on selection
This closes https://github.com/select2/select2/issues/3735
This closes https://github.com/select2/select2/pull/3821
2015-11-23 18:34:37 -05:00
Kevin Brown
e08222ef15 Tests for the inline search box
This adds tests for the following commits

5f80c5d9f8

395e06aff5
2015-11-23 18:25:09 -05:00
Kevin Brown
5f80c5d9f8 Resize search after removing a choice
This fixes a previous bug with the backspace handler on the multiple
select search box where unselecting a choice through the keyboard would
not properly size the search box. As a result, most of the text would be
cut off and it was very clear that there was an issue.

In addition, a blank space was automatically being added to the end of
the search query. This blank space would not be removed at all, so the
user had to manually remove it.

Additionally, a query would be triggered for the last used search term
instead of the new search term that would be loaded in. This caused
incorrect results to be displayed most of the time.

All of these issues have been fixed by triggering a new search query
after an option has been removed through the keyboard. This will resize
the search box automatically, which fixes the main issue, and it will
trigger a search with the correct query.

This closes https://github.com/select2/select2/issues/3297
This closes https://github.com/select2/select2/pull/3398
2015-11-23 18:22:33 -05:00
Kevin Brown
8763a87779 Merge pull request #3946 from manuel-alvarez-alvarez/master
Add the decorator parameter to the handlers for the attach and detach of the dropdown
2015-11-23 16:49:59 -05:00
Kevin Brown
f94b462b15 Merge pull request #3943 from limonte/sr-Cyrl
Add sr-Cyrl language.
2015-11-23 15:43:03 -05:00
Limon Monte
410916510d Add errorLoading error message to sr, sr-Latin and hr languages. 2015-11-20 11:39:35 +01:00
Limon Monte
1c8d1f8e0d Add sr-Cyrl language. 2015-11-20 11:38:13 +01:00
Manuel Alvarez Alvarez
a06a08a028 Fixed jshint errors due to too long lines on the attachBody adapter 2015-11-19 15:49:52 +01:00
Manuel Alvarez Alvarez
eae4d01158 Add the decorator parameter to the handlers for the attach and detach the dropdown (otherwise the container is undefined) 2015-11-19 15:39:28 +01:00