Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/droplab/plugins/input_setter.js')
-rw-r--r--app/assets/javascripts/droplab/plugins/input_setter.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/assets/javascripts/droplab/plugins/input_setter.js b/app/assets/javascripts/droplab/plugins/input_setter.js
index b1716c72810..c292cfa7b8f 100644
--- a/app/assets/javascripts/droplab/plugins/input_setter.js
+++ b/app/assets/javascripts/droplab/plugins/input_setter.js
@@ -33,12 +33,13 @@ const InputSetter = {
setInput(config, selectedItem) {
const input = config.input || this.hook.trigger;
const newValue = selectedItem.getAttribute(config.valueAttribute);
+ const inputAttribute = config.inputAttribute;
- if (input.tagName === 'INPUT') {
- input.value = newValue;
- } else {
- input.textContent = newValue;
- }
+ if (!newValue) return;
+
+ if (input.hasAttribute(inputAttribute)) return input.setAttribute(inputAttribute, newValue);
+ if (input.tagName === 'INPUT') return input.value = newValue;
+ return input.textContent = newValue;
},
destroy() {