Skip to content

Commit df7c212

Browse files
committed
New option to control the events the plugin listen to
1 parent 29f1de5 commit df7c212

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 2.0.1dev
4+
5+
- Fix bad assignment in the plugin initialization.
6+
- Russian localization.
7+
- New option to control the events the plugin listen to.
8+
39
## 2.0.0
410

511
- Use six possible verdicts and six possible css classes, so they match one

OPTIONS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ Let's see the options of each section.
7878
An array of strings. A list of banned words for the zxcvbn library. This
7979
option will be ignored if zxcvbn is not being used.
8080

81+
* __events__: `["keyup", "change", "paste"]` (Array)
82+
83+
An array of strings. A list of the event names the plugin is going to listen
84+
to. Customize this option to deal with iOS 9 keyup bug.
85+
8186
* __debug__:
8287

8388
Default: `false` (Boolean)

src/methods.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ var methods = {};
9191

9292
localOptions.instances = {};
9393
$el.data("pwstrength-bootstrap", localOptions);
94-
$el.on("keyup", onKeyUp);
95-
$el.on("change", onKeyUp);
96-
$el.on("paste", onPaste);
94+
95+
$.each(localOptions.common.events, function (idx, eventName) {
96+
var handler = eventName === "paste" ? onPaste : onKeyUp;
97+
$el.on(eventName, handler);
98+
});
9799

98100
ui.initUI(localOptions, $el);
99101
$el.trigger("keyup");

src/options.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ defaultOptions.common.zxcvbn = false;
2323
defaultOptions.common.zxcvbnTerms = [
2424
// List of disrecommended words
2525
];
26+
defaultOptions.common.events = ["keyup", "change", "paste"];
2627
defaultOptions.common.debug = false;
2728

2829
defaultOptions.rules = {};

0 commit comments

Comments
 (0)