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:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-07 01:03:11 +0300
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-07 01:03:11 +0300
commit993c2071ab95ffc96fcabb77042f64ca3c3d60d5 (patch)
tree4115f4bc3eede0baf5fb0439c7c2b9387ae23d69 /app/assets/javascripts/droplab
parent66d03aae98cc0429d2ed75eac68025f447868479 (diff)
Update inputsetter
Diffstat (limited to 'app/assets/javascripts/droplab')
-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() {