diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-06 23:03:11 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-06 23:03:11 +0100 |
commit | 993c2071ab95ffc96fcabb77042f64ca3c3d60d5 (patch) | |
tree | 4115f4bc3eede0baf5fb0439c7c2b9387ae23d69 /app/assets | |
parent | 66d03aae98cc0429d2ed75eac68025f447868479 (diff) | |
download | gitlab-ce-993c2071ab95ffc96fcabb77042f64ca3c3d60d5.tar.gz |
Update inputsetter
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/droplab/plugins/input_setter.js | 11 |
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() { |