sanity check for reactive labels

This commit is contained in:
Felix Hamann 2018-03-28 23:41:48 +02:00
parent 511a3fef7b
commit 6c680a109c

View File

@ -156,6 +156,11 @@ document.addEventListener('DOMContentLoaded', function() {
// setup reactive labels
Array.from(document.querySelectorAll('.reactive-label')).forEach(function(label) {
var input = document.querySelector('#' + label.getAttribute('for'));
if (!input) {
console.error('No input found for ReactiveLabel! Targeted input: \'#%s\'', label.getAttribute('for'));
return false;
}
var parent = label.parentElement;
var type = input.getAttribute('type');
var isFileInput = /file/i.test(type);