|
155 | 155 | this.prepareElements = bind(this.prepareElements, this); |
156 | 156 | this.init = bind(this.init, this); |
157 | 157 | this.config = this.constructor.config; |
| 158 | + this.ns = 'inputvalidator'; |
158 | 159 | this.init(config); |
159 | 160 | } |
160 | 161 |
|
|
170 | 171 | }; |
171 | 172 |
|
172 | 173 | InputValidator.prototype.prepareElements = function(context) { |
173 | | - var $elements, ns; |
| 174 | + var $elements; |
174 | 175 | if (context == null) { |
175 | 176 | context = null; |
176 | 177 | } |
177 | 178 | if (context == null) { |
178 | 179 | context = this.context; |
179 | 180 | } |
180 | | - ns = 'inputvalidator'; |
181 | 181 | $elements = this.elementsFor(context); |
182 | 182 | if (this.config.validateOnFocusOut) { |
183 | | - $elements.off("focusout." + ns).on("focusout." + ns, (function(_this) { |
| 183 | + $elements.off("focusout." + this.ns).on("focusout." + this.ns, (function(_this) { |
184 | 184 | return function(e) { |
185 | 185 | return _this.validateElement(e.target); |
186 | 186 | }; |
187 | 187 | })(this)); |
188 | 188 | } |
189 | 189 | if (this.config.removeHintOnFocus) { |
190 | | - $elements.off("focus." + ns).on("focus." + ns, (function(_this) { |
| 190 | + $elements.off("focus." + this.ns).on("focus." + this.ns, (function(_this) { |
191 | 191 | return function(e) { |
192 | 192 | return _this.resetElement(e.target); |
193 | 193 | }; |
194 | 194 | })(this)); |
195 | 195 | } |
196 | 196 | if (this.config.validateOnKeyUp) { |
197 | | - $elements.off("keyup." + ns).on("keyup." + ns, (function(_this) { |
| 197 | + $elements.off("keyup." + this.ns).on("keyup." + this.ns, (function(_this) { |
198 | 198 | return function(e) { |
199 | 199 | if ($(e.target).data('invalid')) { |
200 | 200 | return _this.validateElement(e.target); |
|
203 | 203 | })(this)); |
204 | 204 | } |
205 | 205 | if (this.config.validateOnClick) { |
206 | | - return $elements.off("click." + ns).on("click." + ns, (function(_this) { |
| 206 | + return $elements.off("click." + this.ns).on("click." + this.ns, (function(_this) { |
207 | 207 | return function(e) { |
208 | 208 | return _this.validateElement(e.target); |
209 | 209 | }; |
|
0 commit comments