- commit
- f55ded9fd008805cec9b0a245c8b2ad121dd502a
- parent
- 31286ad659a35a73341a850a01cc11c16519ef9a
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2021-05-28 11:16
readability: split out early abort in onblur
Diffstat
| M | select.js | 24 | +++++++++++++----------- |
1 files changed, 13 insertions, 11 deletions
diff --git a/select.js b/select.js
@@ -244,18 +244,20 @@ export class Select {
244 244 }
245 245
246 246 onblur(event) {
247 -1 if (event.relatedTarget !== this.dropdown) {
248 -1 if (!this.input.value) {
249 -1 if (!this.original.multiple) {
250 -1 this.original.value = '';
251 -1 }
252 -1 this.close();
253 -1 } else if (this.indexMap.length) {
254 -1 this.setValue(this.indexMap[this.focus]);
255 -1 }
256 -1 if (!this.original.checkValidity()) {
257 -1 this.input.setCustomValidity(this.original.validationMessage);
-1 247 if (event.relatedTarget === this.dropdown) {
-1 248 return;
-1 249 }
-1 250
-1 251 if (!this.input.value) {
-1 252 if (!this.original.multiple) {
-1 253 this.original.value = '';
258 254 }
-1 255 this.close();
-1 256 } else if (this.indexMap.length) {
-1 257 this.setValue(this.indexMap[this.focus]);
-1 258 }
-1 259 if (!this.original.checkValidity()) {
-1 260 this.input.setCustomValidity(this.original.validationMessage);
259 261 }
260 262 }
261 263 }