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

Commit

Permalink
v2.4.3, fire native "change" event
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobius1 committed Sep 15, 2018
1 parent eb6bc31 commit d4e76bd
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ Don't forget to check the [wiki](https://github.com/Mobius1/Selectr/wiki) out an

---

## **Due to time constraints this repo is no longer maintained. Feel free to fork this repo and make it your own.**

---


Features:

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobius1-selectr",
"version": "2.4.2",
"version": "2.4.3",
"ignore": [
".gitattributes",
"README.md"
Expand Down
2 changes: 1 addition & 1 deletion dist/selectr.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions dist/selectr.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobius1-selectr",
"version": "2.4.2",
"version": "2.4.3",
"description": "A lightweight, dependency-free, mobile-friendly javascript select box replacement.",
"main": "dist/selectr.min.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/selectr.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Selectr 2.4.2
* Selectr 2.4.3
* http://mobius.ovh/docs/selectr
*
* Released under the MIT license
Expand Down
17 changes: 10 additions & 7 deletions src/selectr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Selectr 2.4.2
* Selectr 2.4.3
* http://mobius.ovh/docs/selectr
*
* Released under the MIT license
Expand Down Expand Up @@ -1598,6 +1598,8 @@
this.emit("selectr.change", option);

this.emit("selectr.select", option);

this.el.dispatchEvent(new Event('change'));
};

/**
Expand Down Expand Up @@ -1647,6 +1649,8 @@
this.emit("selectr.change", null);

this.emit("selectr.deselect", option);

this.el.dispatchEvent(new Event('change'));
};

/**
Expand Down Expand Up @@ -1722,7 +1726,6 @@
*/
Selectr.prototype.add = function(data, checkDuplicate) {
if (data) {

this.data = this.data || [];
this.items = this.items || [];
this.options = this.options || [];
Expand Down Expand Up @@ -1768,14 +1771,14 @@
if (data.selected) {
this.select(option.idx);
}

// We may have had an empty select so update
// the placeholder to reflect the changes.
this.setPlaceholder();

return option;
}

// We may have had an empty select so update
// the placeholder to reflect the changes.
this.setPlaceholder();

// Recount the pages
if (this.config.pagination) {
this.paginate();
Expand Down Expand Up @@ -2292,4 +2295,4 @@
};

return Selectr;
}));
}));

0 comments on commit d4e76bd

Please sign in to comment.