Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit d4e76bd

Browse files
author
Mobius1
committed
v2.4.3, fire native "change" event
1 parent eb6bc31 commit d4e76bd

7 files changed

Lines changed: 21 additions & 22 deletions

File tree

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ Don't forget to check the [wiki](https://github.com/Mobius1/Selectr/wiki) out an
88

99
---
1010

11-
## **Due to time constraints this repo is no longer maintained. Feel free to fork this repo and make it your own.**
12-
13-
---
14-
1511

1612
Features:
1713

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mobius1-selectr",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"ignore": [
55
".gitattributes",
66
"README.md"

dist/selectr.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/selectr.min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mobius1-selectr",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"description": "A lightweight, dependency-free, mobile-friendly javascript select box replacement.",
55
"main": "dist/selectr.min.js",
66
"scripts": {

src/selectr.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Selectr 2.4.2
2+
* Selectr 2.4.3
33
* http://mobius.ovh/docs/selectr
44
*
55
* Released under the MIT license

src/selectr.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Selectr 2.4.2
2+
* Selectr 2.4.3
33
* http://mobius.ovh/docs/selectr
44
*
55
* Released under the MIT license
@@ -1598,6 +1598,8 @@
15981598
this.emit("selectr.change", option);
15991599

16001600
this.emit("selectr.select", option);
1601+
1602+
this.el.dispatchEvent(new Event('change'));
16011603
};
16021604

16031605
/**
@@ -1647,6 +1649,8 @@
16471649
this.emit("selectr.change", null);
16481650

16491651
this.emit("selectr.deselect", option);
1652+
1653+
this.el.dispatchEvent(new Event('change'));
16501654
};
16511655

16521656
/**
@@ -1722,7 +1726,6 @@
17221726
*/
17231727
Selectr.prototype.add = function(data, checkDuplicate) {
17241728
if (data) {
1725-
17261729
this.data = this.data || [];
17271730
this.items = this.items || [];
17281731
this.options = this.options || [];
@@ -1768,14 +1771,14 @@
17681771
if (data.selected) {
17691772
this.select(option.idx);
17701773
}
1774+
1775+
// We may have had an empty select so update
1776+
// the placeholder to reflect the changes.
1777+
this.setPlaceholder();
17711778

17721779
return option;
17731780
}
17741781

1775-
// We may have had an empty select so update
1776-
// the placeholder to reflect the changes.
1777-
this.setPlaceholder();
1778-
17791782
// Recount the pages
17801783
if (this.config.pagination) {
17811784
this.paginate();
@@ -2292,4 +2295,4 @@
22922295
};
22932296

22942297
return Selectr;
2295-
}));
2298+
}));

0 commit comments

Comments
 (0)