From f0a4e3c024e06e4cf1053de6b5606d7a8538835e Mon Sep 17 00:00:00 2001 From: Ignacio Cuadra Date: Mon, 7 Nov 2022 18:23:41 -0300 Subject: [PATCH 1/2] Attribute 'element' added (no-jquery version of '$element'). Variable 'element' in 'init' function replaced by new 'element' attribute --- js/bootstrap-select.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/js/bootstrap-select.js b/js/bootstrap-select.js index 6dccf36dc..4f7533602 100644 --- a/js/bootstrap-select.js +++ b/js/bootstrap-select.js @@ -872,6 +872,7 @@ valHooks.useDefault = true; } + this.element = element; this.$element = $(element); this.$newElement = null; this.$button = null; @@ -996,19 +997,18 @@ init: function () { var that = this, - id = this.$element.attr('id'), - element = this.$element[0], - form = element.form; + id = this.element.getAttribute('id'), + form = this.element.form; selectId++; this.selectId = 'bs-select-' + selectId; - element.classList.add('bs-select-hidden'); + this.element.classList.add('bs-select-hidden'); - this.multiple = this.$element.prop('multiple'); - this.autofocus = this.$element.prop('autofocus'); + this.multiple = this.element.multiple; + this.autofocus = this.element.autofocus; - if (element.classList.contains('show-tick')) { + if (this.element.classList.contains('show-tick')) { this.options.showTick = true; } @@ -1019,9 +1019,9 @@ .prependTo(this.$newElement); // ensure select is associated with form element if it got unlinked after moving it inside newElement - if (form && element.form === null) { + if (form && this.element.form === null) { if (!form.id) form.id = 'form-' + this.selectId; - element.setAttribute('form', form.id); + this.element.setAttribute('form', form.id); } this.$button = this.$newElement.children('button'); @@ -1030,7 +1030,7 @@ this.$menuInner = this.$menu.children('.inner'); this.$searchbox = this.$menu.find('input'); - element.classList.remove('bs-select-hidden'); + this.element.classList.remove('bs-select-hidden'); this.fetchData(function () { that.render(true); @@ -1095,7 +1095,7 @@ } }); - if (element.hasAttribute('required')) { + if (this.element.hasAttribute('required')) { this.$element.on('invalid' + EVENT_KEY, function () { that.$button[0].classList.add('bs-invalid'); From b32505660ef8c545866084e7f201557643f0c5a7 Mon Sep 17 00:00:00 2001 From: Ignacio Cuadra Date: Thu, 10 Nov 2022 10:04:40 -0300 Subject: [PATCH 2/2] new eslint config (basic config) to remove linnter errors in cypress --- .eslintrc.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..e7c966d49 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,11 @@ +{ + "parserOptions": { + "sourceType": "module", + "ecmaVersion": "latest" + }, + "env": { + "es6": true, + "browser": true, + "jquery": true + } +}